O'Reilly logo

PrimeFaces Cookbook - Second Edition by Oleg Varaksin, Mert Çalışkan

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

Making dataTable responsive

Starting with PrimeFaces v5.2, it's possible to make the dataTable component act responsively according to the resizing of the browser.

How to do it…

The priority attribute of <p:column> should be set to a value between 1 to 6, from the highest priority to the lowest one. A definition of the priority attribute is given here:

<p:dataTable id="withPriority" var="car"
  value="#{dataTableBean.detailedCars}">
  <p:column headerText="Name">
    <h:outputText value="#{car.name}" />
  </p:column>
  <p:column headerText="Year" priority="1">
    <h:outputText value="#{car.year}" />
  </p:column>
  <p:column headerText="Color" priority="3">
    <h:outputText value="#{car.color}" />
  </p:column>
  <p:column headerText="Seat Number" priority="2"> <h:outputText ...

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