Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Presenting variable number of columns with primefaces datatable

 
Vladislav Simovic
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • 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?
 
karan khosla
Greenhorn
Posts: 25
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hope! This Helps.

Cheers!
Karan
 
Vladislav Simovic
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Brendan Healey
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • 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=.
 
Mark Bessem
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
p: is PrimeFaces http://www.primefaces.org
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic