• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Presenting variable number of columns with primefaces datatable

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following problem my application returns a list of columns form database, and each column has array of its elements. I want to present it on JSF page. Problem is number of columns is not fixed.

So far I have managed to print output via something like this:



But I would like to present it in the form of datatable, i have been using primefaces datatable, but i havent had much success. How can this be done?
 
Greenhorn
Posts: 25
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Hope! This Helps.

Cheers!
Karan
 
Vladislav Simovic
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

karan khosla wrote:

Hope! This Helps.

Cheers!
Karan



Thats just regular datatable, which has one column. I need to be able to make datatable that has varible number of columns that is known in runtime.
 
Vladislav Simovic
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I finally resolved this problem, this is how it is done:





More info can be found here: http://www.primefaces.org/showcase/ui/datatableDynamicColumns.jsf;jsessionid=57691A43B05DFACB3DDCB9E7287EF254
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whilst p:columns is the most flexible approach if you have the occasional column that
you want to enable/disable you can use p:column rendered=.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is columns part of richfaces? because richfaces doesn't recognise the tag for me.
 
Brendan Healey
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
p: is PrimeFaces http://www.primefaces.org
 
reply
    Bookmark Topic Watch Topic
  • New Topic