aboutsummaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-01-23 15:52:43 +0200
committerTeemu Suo-Anttila <teemusa@vaadin.com>2015-01-26 09:43:52 +0200
commit4136d84671305e96358b50b0e6d6f996444bf9a7 (patch)
tree81939c359fcbf66912059d3a703f6f893c1d35bb /server/src
parentc410fa7e85e0769369cee2cebd2cea538919af2b (diff)
downloadvaadin-framework-4136d84671305e96358b50b0e6d6f996444bf9a7.tar.gz
vaadin-framework-4136d84671305e96358b50b0e6d6f996444bf9a7.zip
Fix Grid setting non-sortable column sortable (#16483)
Change-Id: I7986ceb6ab1900bd1d5269c78c2f6b2e23c46334
Diffstat (limited to 'server/src')
-rw-r--r--server/src/com/vaadin/ui/Grid.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java
index d77c6411ef..ab27a141b7 100644
--- a/server/src/com/vaadin/ui/Grid.java
+++ b/server/src/com/vaadin/ui/Grid.java
@@ -2154,11 +2154,20 @@ public class Grid extends AbstractComponent implements SelectionNotifier,
public Column setSortable(boolean sortable) {
checkColumnIsAttached();
- if (sortable && !(grid.datasource instanceof Sortable)) {
- throw new IllegalStateException(
- "Can't set column "
- + toString()
- + " sortable. The Container of Grid does not implement Sortable");
+ if (sortable) {
+ if (!(grid.datasource instanceof Sortable)) {
+ throw new IllegalStateException(
+ "Can't set column "
+ + toString()
+ + " sortable. The Container of Grid does not implement Sortable");
+ } else if (!((Sortable) grid.datasource)
+ .getSortableContainerPropertyIds().contains(propertyId)) {
+ throw new IllegalStateException(
+ "Can't set column "
+ + toString()
+ + " sortable. Container doesn't support sorting by property "
+ + propertyId);
+ }
}
state.sortable = sortable;