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();
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