summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2018-04-13 17:16:05 +0300
committerIlia Motornyi <elmot@vaadin.com>2018-04-13 17:16:05 +0300
commitda8f5adcae46ba7533578b4d8a9e5e1ac5dfe536 (patch)
tree3d5119fcb6ede4e10b6a610464b15dfccff84955 /server
parent714a7c251d3c00cef4bad68b9bfb7d6802059d38 (diff)
downloadvaadin-framework-da8f5adcae46ba7533578b4d8a9e5e1ac5dfe536.tar.gz
vaadin-framework-da8f5adcae46ba7533578b4d8a9e5e1ac5dfe536.zip
Fix Grid Column not sortable with backend data and sort property (#10811)
Diffstat (limited to 'server')
-rw-r--r--server/src/main/java/com/vaadin/ui/Grid.java13
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java2
2 files changed, 9 insertions, 6 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java
index 0fe3709ec5..887a43f5c8 100644
--- a/server/src/main/java/com/vaadin/ui/Grid.java
+++ b/server/src/main/java/com/vaadin/ui/Grid.java
@@ -1347,9 +1347,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
*/
public Column<T, V> setSortProperty(String... properties) {
Objects.requireNonNull(properties, "Sort properties can't be null");
- sortOrderProvider = dir -> Arrays.stream(properties)
- .map(s -> new QuerySortOrder(s, dir));
- return this;
+ return setSortOrderProvider(dir -> Arrays.stream(properties)
+ .map(s -> new QuerySortOrder(s, dir)));
}
/**
@@ -1369,6 +1368,10 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
Objects.requireNonNull(provider,
"Sort order provider can't be null");
sortOrderProvider = provider;
+
+ // Update state
+ updateSortable();
+
return this;
}
@@ -2226,7 +2229,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
setSortable(false);
}
if (design.hasAttr("editable")) {
- /*
+ /**
* This is a fake editor just to have something (otherwise
* "setEditable" throws an exception.
*
@@ -3146,7 +3149,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
* the mode in to which Grid should be set
*/
public void setHeightMode(HeightMode heightMode) {
- /*
+ /**
* This method is a workaround for the fact that Vaadin re-applies
* widget dimensions (height/width) on each state change event. The
* original design was to have setHeight and setHeightByRow be equals,
diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java b/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java
index 01637760d8..87d3c5ef11 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java
@@ -777,7 +777,7 @@ public class GridTest {
Assert.assertTrue("Column should be marked sortable",
column.isSortable());
- Assert.assertFalse(
+ Assert.assertTrue(
"User should be able to sort the column with the sort order",
column.isSortableByUser());
}