public void onColumnSort(ColumnSortEvent event) { // Get the sorted column. Column<?, ?> column = event.getColumn(); if (column == null) { return; } // Get the comparator. final Comparator<T> comparator = comparators.get(column); if (comparator == null) { return; } // Sort using the comparator. if (event.isSortAscending()) { Collections.sort(list, comparator); } else { Collections.sort(list, new Comparator<T>() { public int compare(T o1, T o2) { return -comparator.compare(o1, o2); } }); } }
private void applySort(ColumnSortEvent event, SortedListModel<T> sortedModel) { Column<?, ?> column = event.getColumn(); if (!(column instanceof SortableColumn)) {
tableA.addColumnSortHandler(new ColumnSortEvent.Handler() { @Override public void onColumnSort(ColumnSortEvent event) { Column<MyObject, String> columnA = event.getColumn(); // find columnB in tableB that corresponds to columnA in tableA tableB.getColumnSortList().push(new ColumnSortInfo(columnB, event.isSortAscending())); ColumnSortEvent.fire(tableB, tableB.getColumnSortList()); } });
public void onColumnSort(ColumnSortEvent event) { // Get the sorted column. Column<?, ?> column = event.getColumn(); if (column == null) { return; } // Get the comparator. final Comparator<T> comparator = comparators.get(column); if (comparator == null) { return; } // Sort using the comparator. if (event.isSortAscending()) { Collections.sort(list, comparator); } else { Collections.sort(list, new Comparator<T>() { public int compare(T o1, T o2) { return -comparator.compare(o1, o2); } }); } }
public void onColumnSort(ColumnSortEvent event) { // Get the sorted column. Column<?, ?> column = event.getColumn(); if (column == null) { return; } // Get the comparator. final Comparator<T> comparator = comparators.get(column); if (comparator == null) { return; } // Sort using the comparator. if (event.isSortAscending()) { Collections.sort(list, comparator); } else { Collections.sort(list, new Comparator<T>() { public int compare(T o1, T o2) { return -comparator.compare(o1, o2); } }); } }
NameColumn.setSortable(true); patientsTable.addColumnSortHandler(new ColumnSortEvent.Handler() { @Override public void onColumnSort(ColumnSortEvent event) { final Column a = event.getColumn(); List<PatientDTO> newData = new ArrayList(patientsTable.getVisibleItems()); Collections.sort(newData, new Comparator<PatientDTO>() { public int compare(PatientDTO o1, PatientDTO o2) { // code here to sort asc or desc order } }); Range range = patientsTable.getVisibleRange(); int start = range.getStart(); patientsTable.setRowData(start, newData); } });
public void onColumnSort( ColumnSortEvent event ) { lastOrderedColumn = ((DataColumnCell) event.getColumn().getCell()).columnId; lastSortOrder = event.isSortAscending() ? SortOrder.ASCENDING : SortOrder.DESCENDING; redraw(); } });
public void onColumnSort(ColumnSortEvent event) { String column = ((DataColumnCell) event.getColumn().getCell()).columnId; SortOrder order = event.isSortAscending() ? SortOrder.ASCENDING : SortOrder.DESCENDING; getPresenter().sortBy(column, order); } });
public void onColumnSort(ColumnSortEvent event) { String column = ((DataColumnCell) event.getColumn().getCell()).columnId; SortOrder order = event.isSortAscending() ? SortOrder.ASCENDING : SortOrder.DESCENDING; getPresenter().sortBy(column, order); } });