Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to access the current row index in dataTable

 
Robin Sharma
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jamie Williams
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if i am using JSR-RI implementation with Icefaces.
 
Steffen Neustadt
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what about the getRowIndex()-methode of your dataModel?
 
Saeed alkhen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Try this :


and then
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic