Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

To adjust primefaces datatable size,live scrolling with screen size  RSS feed

 
Raghu Sundar
Ranch Hand
Posts: 40
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,I have a datatable with live scrolling feature.The table fits fine in my development machine but the user of this app has larger screen.It would be good if the datatable fits according to the screen size.Also the height of the datatable should get adjusted with more number of rows for live scroll.Currently i have 15 rows for live scrolling.It would be good if the scroll rows increases with the height of the screen.Please help me in this regard.



CSS of the entire page



 
K. Tsang
Bartender
Posts: 3628
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the width of the datatable, your CSS already specifying 100%. However, if it isn't fit the entire width then you need to add the "important!" at the end to override the primefaces internal CSS.



As for the number of rows I think you will need to calculate this value given the screen's height. Now the screen height can get from Javascript but once you do, assigning this value back to the datatable may be a bit tricky.
 
Raghu Sundar
Ranch Hand
Posts: 40
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tsang.The width problem is resolved.I need to try how to achive the correct height.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, while I haven't done styling in PrimeFaces, I think that the styleClass can be used on your dataTable so that you can set the height of the entire control to say, 85% of the displayed page. Of course, I'm also not recently practiced even in vanilla HTML height control via CSS and I suspect it may be obstinate. It's usually easier to command width than height, since a web page can theoretically be infinitely long.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!