This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JSF and the fly likes Showing Sequence No with datatable Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Showing Sequence No with datatable" Watch "Showing Sequence No with datatable" New topic
Author

Showing Sequence No with datatable

Nishita Jain
Ranch Hand

Joined: Mar 30, 2006
Posts: 97
hi,
i m using h : datatable and i that 1 of the colums i want to show sequence No like
1
2
3
4
5
until the datatable loop.
how can i print that between h:column

i also tried using jstl tags but it is not working
any suggestion on this , pl help

Thank u,
Nishita
[ April 03, 2006: Message edited by: Nishita Jain ]

Nishita
Nishita Jain
Ranch Hand

Joined: Mar 30, 2006
Posts: 97
somebody pls help me. i m stuck because of this.
Thank you.
[ April 07, 2006: Message edited by: Nishita Jain ]
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
What I do is put the number inside the bean that is displayed in the row.
Nishita Jain
Ranch Hand

Joined: Mar 30, 2006
Posts: 97
ya, that can be done but is it a good idea to put it in bean ,generate getter setter?
Jamie Williams
Ranch Hand

Joined: Mar 31, 2006
Posts: 70
I'm also stuck on this bugger or a problem. I'm using huge numbers of objects and having to display up to 1000 at a time. I've been for'ing through lists and generating arrays of the object properties with a element that holds a line number, then adding those arrays to another list to pass to the datatable, but this I realise is incredibly inefficient and slow. I'd really like to know if there's a better solution too!
Isn't there something that generates row numbers dynamically?
Bagwan Mehrat
Ranch Hand

Joined: Jan 26, 2002
Posts: 119
Tomahawk's version of the dataTable has a "rowIndexVar" attribute that you can use to do this.
Jamie Williams
Ranch Hand

Joined: Mar 31, 2006
Posts: 70
Thanks alot! That will really help!

For those not using Tomahawk - here's a simple solution.

Use a simple get method in a bean that keeps count of the row number, every time you call the get method, increment it then return. When you want to 'reset' the number (say, for another table on the same page) set your counter back to zero in an empty method that checks if the table is rendered or not eg. isMyDataTableRendered()
Nishita Jain
Ranch Hand

Joined: Mar 30, 2006
Posts: 97
hello,,
thanks for the solution . i think this number solution is already put by Gerardo. but what i want to ask is is that a good way to put your no in bean.. i think we can consider this as bug . what u say?

Nishita
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Showing Sequence No with datatable
 
Similar Threads
how to print ibatis query on console
h:panelGrid with Attribute value
jdk timer vs spring quartz better approach
DataTable with DataScroller issue
How to deploy servelts and jsp in JBoss?