This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

dataTable help  RSS feed

 
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


 
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?
 
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
 
Bartender
Posts: 19673
92
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!