This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes JSF and the fly likes How to access the current row index in dataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to access the current row index in dataTable" Watch "How to access the current row index in dataTable" New topic
Author

How to access the current row index in dataTable

Robin Sharma
Ranch Hand

Joined: Aug 24, 2005
Posts: 76
Hi!

Is there a straightforward way to access the current row index while rendering a standard JSF dataTable component? I want to show the serial number for each row.

Is creating a binding to a bean the only way to do that?

Thanks.


DW
There is always a bug :-)
Jamie Williams
Ranch Hand

Joined: Mar 31, 2006
Posts: 70
Hi Robin, I had the same problem. If you use a Tomahawk dataTable you can the variable 'rowIndexVar' to get the row number, starting at zero. Here is how I print out my row numbers:



Hope this helps!
Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425
What if i am using JSR-RI implementation with Icefaces.


Rahul Juneja
ThoughtClicks - http://techlabs.thoughtclicks.com
Steffen Neustadt
Greenhorn

Joined: Sep 30, 2008
Posts: 11
what about the getRowIndex()-methode of your dataModel?
Saeed alkhen
Greenhorn

Joined: Feb 11, 2009
Posts: 4
Hi,
Try this :


and then
 
 
subject: How to access the current row index in dataTable
 
It's not a secret anymore!