Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

To adjust primefaces datatable size,live scrolling with screen size

 
Ranch Hand
Posts: 40
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tsang.The width problem is resolved.I need to try how to achive the correct height.
 
Saloon Keeper
Posts: 24334
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Men call me Jim. Women look past me to this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic