But whats happening is, the userModel.getRowIndex() method is always returning zero "0", and hence the userModel.getRowData() method is always returning first row object.
Do I need to set the rowIndex manually?
Any help would be appriciated. Thanks in advance
Regards, Pushpa
Pushpalatha Gowdra
Greenhorn
Joined: Jan 25, 2008
Posts: 18
posted
0
The problem resolved
The problem was in my getter method
public DataModel getUserModel() { if(userModel == null) userModel = new ListDataModel(); userModel.setWrappedData(search.getUsersList());
return userModel; }
this method was setting the wrapper everytime we call the method getUserModel.
To make it work properly, I should write the method in the same class where getUserModel() is there, which will give me the getRowData() directly. something like:
public Object getSelectedData() { return userModel.getRowData(); }
And I shouldn't call getUserModel() to get the current model used by the dataTable in the backing bean. It should be used only in the jsf file, to construct the table.