Page 1 of 1

Datatable : default rows number

Posted: 10 Aug 2018, 18:25
by denisduval75
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 ????

Re: Datatable : default rows number

Posted: 13 Aug 2018, 11:20
by kukeltje
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.