2

i have followed the primefaces showcase example for the datatable to make is scrollable across and while it works across it makes all the columns very small and i am unable to really read the columns, the reason for the scrollable function is because of the large amount of columns i need to display, is there any way of keeping the size of the columns but also make the datatable scrollable ?

here is the datatable code :

<p:dataTable id="UserTable"
   widgetVar="usersTable" 
   paginator="true" rows="10"
   value="#{usertableController.items}"
   var="item"
   emptyMessage="No details was found with given criteria"
   scrollable="true" scrollWidth="400">

there are 14 columns in total i need to display

thanks guys

Kuba
  • 2,069
  • 23
  • 30
user2061913
  • 910
  • 2
  • 14
  • 34

1 Answers1

3

You can always give width= "X" to your <p:column> or <p:columns>. It works when the datatable is scrollable. As follows,

<p:column selectionMode="multiple" width="15" />

<p:columns width="150" value="..." var="..." columnIndexVar="..." sortBy="..." filterBy="..." >
Yigitalp Ertem
  • 1,901
  • 24
  • 27
  • Hi there thanks but when i try to implement that i get `javax.faces.FacesException: DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled.` – user2061913 Nov 27 '13 at 10:09
  • 1
    Do you want to use selection? If not, do not use "selectionMode". If you do, did you try adding a "rowKey" to your datatable? You may want to check this: http://stackoverflow.com/questions/12333764/datamodel-must-implement-org-primefaces-model-selectabledatamodel-when-selection – Yigitalp Ertem Nov 27 '13 at 11:18