| Author |
Row Index in RichFaces Data Table
|
Soumya Saha
Ranch Hand
Joined: Apr 14, 2006
Posts: 64
|
|
Hi, I have been really struggling to get the row index from the richFaces Data Table in my java script function. I tried the this object, rowKeyVar attribute, dataTable.rowIndex but nothing seems to work. I binded the data table to an htmldatatable, but still returns 1 only. I am attaching the code for the binding attribute: <h:dataTable binding="#{myBean.dataTable}"> <h:column> <f:facet name="header"> <h utputText value="Row #" /> </f:facet> <h utputText value="#{myBean.dataTable.rowIndex + 1}" /> </h:column> ... </h:dataTable> Any help or any direction will be highly appreciated. Thanks
|
 |
sujit suncert
Greenhorn
Joined: Nov 04, 2008
Posts: 6
|
|
Try like this. Create ListDataModel from list that you are displaying in rich:datatable. new ListDataModel(java.util.List list); To your rich:datatable values attribute set this listdatamodel. Now try row.rowIndex.Should work for sure. Let me know if it does not.
|
-sujit(Never lose hope)
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56153
|
|
|
"sujit sun certified", please check your private messages for an important administrative matter.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Soumya Saha
Ranch Hand
Joined: Apr 14, 2006
Posts: 64
|
|
Hi, I got it to work with rowKeyVar. I can pass that value in my JavaScript Function and it returns me the correct row value. Thanks everybody and long live RichFaces Thanks Soumya
|
 |
 |
|
|
subject: Row Index in RichFaces Data Table
|
|
|