*
The moose likes JSF and the fly likes dataTable help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "dataTable help" Watch "dataTable help" New topic
Author

dataTable help

lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
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

Joined: Oct 08, 2006
Posts: 2458
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

Joined: Oct 15, 2006
Posts: 115
have another question, i have the following conditions in JSP syntax:

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

how do convert to JSF syntax?
Hiren Dutta
Greenhorn

Joined: Dec 30, 2005
Posts: 10
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

Joined: Jun 25, 2001
Posts: 15961
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dataTable help
 
Similar Threads
scope problem with simple search page
Displaying values in the datatable!
DataTable with DataScroller issue
How to use datatable with no records in a list
datatable renders empty rows