Datatable : default rows number

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

10 Aug 2018, 18:25

Hello,
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 ????

kukeltje
Expert Member
Posts: 9605
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.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 30 guests