JSF DataModelEvent for Row Selected
Hello,
I have a JSF DataTable with a row selection listener (DataModelEvent). When running the web application the listener returns -1 for the getRowIndex(). I have tried getting the source of the event and getting selected row through that but still get -1. Is there a bug with this listener or am I just missing something? The event is being fired because the code I have in the event handler is running just not getting the selected row of the table. Sorry if this has been answered elsewhere, I searched but did not find an answer.
Here is the code for the data table:
<h:dataTable binding="#{a.dataTable1}" id="dataTable1" rowClasses="list-row-even,list-row-odd" style="width: 800px"
value="#{a.dataTable1Model}" var="currentRow">
<h:column id="column1">
<h:commandLink action="case2">
<h:outputText binding="#{a.outputText1}" id="outputText1" value="#{currentRow['name']}"/>
</h:commandLink>
</h:column>
</h:dataTable>
And the event handler:
privatevoid _init()throws Exception{
dataTable1Model.addDataModelListener(new DataModelListener(){
publicvoid rowSelected(DataModelEvent dme){
dataTable1Model_rowSelected(dme);
}
});
}
publicvoid dataTable1Model_rowSelected(DataModelEvent dme){
getSessionBean1().setReferer("A");
getSessionBean1().setRefererurl("/faces/a.jsp");
getSessionBean1().setCurrent(String.valueOf(dme.getDataModel().getRowIndex()));
}

