diff options
author | Leif Åstrand <leif@vaadin.com> | 2014-07-09 21:29:49 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-07-10 10:38:44 +0000 |
commit | 2ef88966831c2bc64e5be645ff3bda2adb58f70a (patch) | |
tree | 5219633bd94391194df4397636f1806934659cbb | |
parent | d2e8872bd9fe9a268d71c2162dac64faa8b9288d (diff) | |
download | vaadin-framework-2ef88966831c2bc64e5be645ff3bda2adb58f70a.tar.gz vaadin-framework-2ef88966831c2bc64e5be645ff3bda2adb58f70a.zip |
Update sorting indicators when sorting through the API (#13334)
Change-Id: I34e56a731ee7263cee6b79588993f27e92e1aa5f
-rw-r--r-- | client/src/com/vaadin/client/ui/grid/Grid.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/client/src/com/vaadin/client/ui/grid/Grid.java b/client/src/com/vaadin/client/ui/grid/Grid.java index d1541ba505..d03197e2ef 100644 --- a/client/src/com/vaadin/client/ui/grid/Grid.java +++ b/client/src/com/vaadin/client/ui/grid/Grid.java @@ -385,6 +385,15 @@ public class Grid<T> extends Composite implements Element cellElement = cell.getElement(); if (grid.getColumn(cell.getColumn()).isSortable()) { if (sortingOrder != null) { + if (SortDirection.ASCENDING == sortingOrder + .getDirection()) { + cellElement.replaceClassName("sort-desc", + "sort-asc"); + } else { + cellElement.replaceClassName("sort-asc", + "sort-desc"); + } + int sortIndex = grid.getSortOrder().indexOf( sortingOrder); if (sortIndex > -1 @@ -497,12 +506,6 @@ public class Grid<T> extends Composite implements boolean multisort) { TableCellElement th = TableCellElement.as(cell.getElement()); - if (SortDirection.ASCENDING.equals(direction)) { - th.replaceClassName("sort-desc", "sort-asc"); - } else { - th.replaceClassName("sort-asc", "sort-desc"); - } - // Apply primary sorting on clicked column GridColumn<C, T> columnInstance = getColumnInstance(); Sort sorting = Sort.by(columnInstance, direction); @@ -519,9 +522,6 @@ public class Grid<T> extends Composite implements // Perform sorting grid.sort(sorting); - - // Update header indicators - grid.refreshHeader(); } /** @@ -2448,6 +2448,7 @@ public class Grid<T> extends Composite implements * Apply sorting to data source. */ private void sort() { + refreshHeader(); fireEvent(new SortEvent<T>(this, Collections.unmodifiableList(sortOrder))); } |