diff options
author | Mika Murtojarvi <mika@vaadin.com> | 2015-04-27 17:42:32 +0300 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2015-05-15 08:37:57 +0300 |
commit | aca7f85b9793b3042b877d627c02e2613fb3e713 (patch) | |
tree | eccdc2577ff7f3f39ac3a4adf06966a9747d3ea8 /server | |
parent | 41a07966dd8bd1d4d4bbd6540ec1ce17a323d1e2 (diff) | |
download | vaadin-framework-aca7f85b9793b3042b877d627c02e2613fb3e713.tar.gz vaadin-framework-aca7f85b9793b3042b877d627c02e2613fb3e713.zip |
Fix the updating of sort indicators (#17440)
Change-Id: Ia91e2022b17417f4a56a0797a04d39381652cbf0
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/ui/Grid.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java index b8b5040b13..b167d08010 100644 --- a/server/src/com/vaadin/ui/Grid.java +++ b/server/src/com/vaadin/ui/Grid.java @@ -3069,8 +3069,21 @@ public class Grid extends AbstractComponent implements SelectionNotifier, Object propertyId = getPropertyIdByColumnId(columnIds[i]); order.add(new SortOrder(propertyId, directions[i])); } - setSortOrder(order, userOriginated); + if (!order.equals(getSortOrder())) { + /* + * Actual sort order is not what the client expects. Make + * sure the client gets a state change event by clearing the + * diffstate and marking as dirty + */ + ConnectorTracker connectorTracker = getUI() + .getConnectorTracker(); + JsonObject diffState = connectorTracker + .getDiffState(Grid.this); + diffState.remove("sortColumns"); + diffState.remove("sortDirs"); + markAsDirty(); + } } @Override @@ -4221,9 +4234,6 @@ public class Grid extends AbstractComponent implements SelectionNotifier, cs.sort(propertyIds, directions); - fireEvent(new SortEvent(this, new ArrayList<SortOrder>(sortOrder), - userOriginated)); - if (columns.keySet().containsAll(Arrays.asList(propertyIds))) { String[] columnKeys = new String[items]; for (int i = 0; i < items; ++i) { @@ -4236,6 +4246,8 @@ public class Grid extends AbstractComponent implements SelectionNotifier, getState().sortColumns = new String[] {}; getState(false).sortDirs = new SortDirection[] {}; } + fireEvent(new SortEvent(this, new ArrayList<SortOrder>(sortOrder), + userOriginated)); } else { throw new IllegalStateException( "Container is not sortable (does not implement Container.Sortable)"); |