Datatable : default rows number

UI Components for JSF
Post Reply
Posts: 61
Joined: 08 Nov 2016, 16:53

10 Aug 2018, 18:25

I use a Datatable with paginator.
I would like to display a maximum of rows by default depending on the screen resolution.
After a very long time I can not find a solution.
Please can you help me?
Thank you very much.

Examples with 20px rows and header and footer = 156px:

Resolution of 1080px in height
Number of rows = 26 <- how to calculate 26?

Resolution of 1050px in height
Number of rows = 25 <- how to calculate 25?

Resolution of 1024px in height
Number of rows = 24 <- how to calculate 24?

Resolution of 960px in height
Number of rows = 30 <- how to calculate 30 ????

Expert Member
Posts: 9079
Joined: 17 Jun 2010, 13:34
Location: Netherlands

13 Aug 2018, 11:20

95% of the solution is not JSF/PrimeFaces related. Search for some javascript that can detect screen size (and detect screensize changes for rotation?). Use the related event to call a server side method (via a remote command in case of jsf, or plain jquery ajax/rest if you want) and in this call pass the screen size. Use that server side to calculate the rows.
Ronald van Kuijk
PrimeFaces 6.1, PrimeFaces plus 0.0.2 | JbossWildfly 10.1| Mojarra 2.2.13
Fedora 61, Firefox 'most recent'
Read the forum posting rules

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests