O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – using a ScrollPanel component

Let us see how we can use ScrollPanel to display overflowed content with scrollbars.

  1. Create a ScrollPanel and set height and width using a style attribute:
    <p:scrollPanel style="width:300px;height:250px">  
      <p:dataTable var="user" value="#{adminController.users}">  
        <f:facet name="header">
          List of Users
        </f:facet>
        <p:column headerText="Id">  
          <h:outputText value="#{user.id}" />  
        </p:column>  
        <p:column headerText="Email">  
          <h:outputText value="#{user.emailId}" />  
        </p:column>  
        <p:column headerText="FirstName">  
          <h:outputText value="#{user.firstName}" />  
        </p:column>  
        <p:column headerText="Disabled">  
          <h:outputText value="#{user.disabled}" />  
        </p:column>  
      </p:dataTable>  
    </p:scrollPanel>

What just happened?

We have created ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required