1, Backing Bean中设置排序方法
- public void sortMethod(SortEvent event){
- DCIteratorBinding iter = ADFUtils.findIterator("xxxxVOIterator");
- String propery = event.getSortCriteria().get(0).getProperty();
- String isAsending = event.getSortCriteria().get(0).isAscending() == true ? "asc" : "desc";
- //在内存中排序
- ViewObject vo = iter.getViewObject();
- vo.setSortBy(propery + " " + isAsending);
- vo.setQueryMode(ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
- vo.executeQuery();
- vo.setSortBy(null); //去除排序基准
- SortCriteria[] sc = new SortCriteria[0];
- iter.applySortCriteria(sc);
- }
2,在RichTable中添加sort listener事件
- <af:table .....
- sortListener="#{backing_xxx.sortMethod}"