more sorting, but some rows mysteriously disapper. try sorting on name and see first meeting disappear when sort order is descending

This commit is contained in:
fred-fri 2012-05-04 20:59:51 +09:00
parent bfcd55a825
commit 333d8f49f3

@ -72,8 +72,9 @@ public class CheckListTemplateDataPanel extends Panel {
};
columns[1] = new PropertyColumn<CheckListTemplate>(Model.of("Creator"), "creator", "creator");
columns[2] = new PropertyColumn<CheckListTemplate>(Model.of("Categories"), "categories", "categories");
columns[3] = new PropertyColumn<CheckListTemplate>(Model.of("Created"), "dateCreated", "dateCreated");
columns[2] = new PropertyColumn<CheckListTemplate>(Model.of("Categories"), "categories");
// columns[3] = new PropertyColumn<CheckListTemplate>(Model.of("Created"), "dateCreated", "dateCreated");
columns[3] = new PropertyColumn<CheckListTemplate>(Model.of("Updated"), "lastModified", "lastModified");
table = new DataTable<CheckListTemplate>("datatable", columns, checklistTemplateProvider = new ChecklistTemplateProvider(), 10);
@ -96,7 +97,15 @@ public class CheckListTemplateDataPanel extends Panel {
public Iterator<? extends CheckListTemplate> iterator(int first, int count) {
// Sort(Direction direction, String... properties)
// new Sort(Sort.Direction.ASC, "name")
return checklistTemplateService.find(filterString, new PageRequest(table.getCurrentPage(), count, new Sort(Sort.Direction.ASC, "name"))).iterator();
Sort sort;
if (getSort().isAscending()){
sort = new Sort(Sort.Direction.ASC, getSort().getProperty());
}
else {
sort = new Sort(Sort.Direction.DESC, getSort().getProperty());
}
// new Sort(Sort.Direction.ASC, getSort().toString())
return checklistTemplateService.find(filterString, new PageRequest(table.getCurrentPage(), count, sort)).iterator();
}
@Override