Removing "preserveState='true'" from the DataTable seemed to fix the
problem.
Rick Reumann wrote the following on 9/13/2005 3:08 PM:
Rick Reumann wrote the following on 9/13/2005 2:57 PM:
Mathias Brökelmann wrote the following on 9/13/2005 11:32 AM:
Yes it should work.
Things are also getting really screwed up after a sort takes place and
then I try to get a handle the row selected by doing...
this.employee =
(EmployeeVO)getEmployeesListBean().getEmployeesModel().getRowData();
Narrowing this down a bit more. I notice the above is always grabbing
the 'last row' in the DataModel, regardless of which one is selected. So
after a sort and you click on the "edit" button on the row, it will
bring back the last row regardless of which one is clicked on from...
<h:commandLink value="#{msgs.edit}"
action="#{employeeAction.prepareForEdit}"/>
prepareForEdit() has the
this.employee =
(EmployeeVO)getEmployeesListBean().getEmployeesModel().getRowData();
After a sort takes place, I am no longer able to get the correct row
that is selected.
I am even using two methos now in my EmployeesListBean:
public ListDataModel getEmployeesModelSorted() {
log.debug("getEmployeesModelSorted");
sort(getSort(), isAscending());
return model;
}
public ListDataModel getEmployeesModel() {
log.debug("getEmployeesModelUnsorted");
//don't sort here since this method gets called from EmployeeAction
return model;
}
The JSP is using:
<t:dataTable var="emp"
value="#{employeesListBean.employeesModelSorted}"
the sort method, sorts just like it does in the car example, but I
also am reinitializing the Model...
Collections.sort(employees, comparator);
//repopulate DataModel, since we just sorted
model = new ListDataModel( employees );
The regular getEmployeesModel() method doesn't call the sort method so
I thought that would mean I'd be able to get a handle to the correct
row selected by the user, but something isn't working correctly.
--
Rick