Row index in data table confusion
Hi,
(Warning, confused noob.)
I'm trying to get the indices of rows in a datatable.
I was following the advice on this thread:
http://forum.java.sun.com/thread.jspa?forumID=427&threadID=549084
The problem is, in IE, my two rows both show "0" for row index, and in FF my rows show "0" and "2" for row index.
Here's what my bean looks like:
publicclass MyBean{
private MyData[] data;// holds the actual data
private ArrayDataModel dataModel;
private UIData dataTable;
// This was already here when I got this class
public DataModel getData(){
dataModel =new ArrayDataModel(data);
return dataModel;
}
// These I added upon the advice of thread.jspa?forumID=427&threadID=549084
public UIData getDataTable(){
return dataTable;
}
publicvoid setRelationshipTable(UIData dataTable){
this.dataTable = dataTable;
}
}
Here's what my data table looks like:
<h:dataTable value="#{MyBean.data}" binding="#{MyBean.dataTable}" var="doc">
<h:column>
<f:facet name="header"> <h:outputText value="#{msgs.someColumnHeader}"/> </f:facet>
<h:selectBooleanCheckbox id="accepted" onclick="return editData(#{MyBean.data.rowIndex + 1})"/>
<h:outputText id="indexOutput" value="#{MyBean.dataTable.rowIndex + 1}"/>
</h:column>
...
</h:dataTable>
As you can see, I tried getting "rowIndex" from both "DataModel" and "UIData", but neither gives me what I need.
Hubert
ps. do I really need three variables (data/dataModel/dataTable) for the same set of data?

