• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dataTable help

 
lynn fann
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1st problem:
i have a dataTable value set as dbBean.subList[0], but how do i replace the '0' to dynamic value, like #{item.id}?

i have try
<h: dataTable value='#{dbBean.subList}[#{item.id}]'>

but it doesn't work. What is the correct way of writing it?


2nd problem:
I loop a list using dataTable, and set rendered true and false for some data. But the dataTable will generate empty space for those data that is rendered false leaving the column very long. When i look at the HTML code, it actually generate the empty <td>. How can i prevent this from happening?

3rd problem:
how do i do to display only once for repeated text? for example with the following data:

category item
fruits apple
fruits orange
vehicle car
furniture chair

when i display on the dataTable, this there any way i can make the word "fruits" to display only once?


Info: im using JSF 1.2

-thanks alot


 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lynn fann wrote:1st problem:
i have a dataTable value set as dbBean.subList[0], but how do i replace the '0' to dynamic value, like #{item.id}?

#{dbBean.subList[item.id]}


I loop a list using dataTable, and set rendered true and false for some data. But the dataTable will generate empty space for those data that is rendered false leaving the column very long. When i look at the HTML code, it actually generate the empty &lt;td>. How can i prevent this from happening?

Make use of the CSS 'display' property in rowClasses.


how do i do to display only once for repeated text? for example with the following data:

category item
fruits apple
fruits orange
vehicle car
furniture chair

when i display on the dataTable, this there any way i can make the word "fruits" to display only once?

Make use of the 'rendered' attribute. Let it evaluate false when the previous row value is the same as the current row value.
 
lynn fann
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have another question, i have the following conditions in JSP syntax:

(plan.indexOf("test")!=1)

how do convert to JSF syntax?
 
Hiren Dutta
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a binding of datatable and generate datatable dynamically from server side with desired value .. please google to know hoew to create dynamic datatable .
http://forums-beta.sun.com/thread.jspa?messageID=4419556
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lynn fann wrote:1st problem:

how do i do to display only once for repeated text? for example with the following data:

category item
fruits apple
fruits orange
vehicle car
furniture chair

when i display on the dataTable, this there any way i can make the word "fruits" to display only once?



You may want to investigate the RichFaces extended datatable. It has support for this kind of stuff without having to load up your view with explicit logic.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic