aboutsummaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
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;