diff options
author | Leif Åstrand <leif@vaadin.com> | 2015-11-19 15:10:56 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-11-25 09:57:05 +0000 |
commit | b4d0865f93c5ba8e08957812bc563f4ad2e9d00f (patch) | |
tree | 42ca61d21153e0d8abebc4e32002c4bb56770153 /client | |
parent | 082851e5479a19df17084598944b45b53b38fd73 (diff) | |
download | vaadin-framework-b4d0865f93c5ba8e08957812bc563f4ad2e9d00f.tar.gz vaadin-framework-b4d0865f93c5ba8e08957812bc563f4ad2e9d00f.zip |
Add stylename to sortable Grid header cells (#16991)
Change-Id: I6c151829236928129c258a99177431d0b972f146
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/widgets/Grid.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index 3033d74867..7086ff86d2 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -5612,18 +5612,26 @@ public class Grid<T> extends ResizeComposite implements FlyweightCell cell) { cleanup(cell); + if (!headerRow.isDefault()) { + // Nothing more to do if not in the default row + return; + } Column<?, ?> column = getVisibleColumn(cell.getColumn()); SortOrder sortingOrder = getSortOrder(column); - if (!headerRow.isDefault() || !column.isSortable() - || sortingOrder == null) { - // Only apply sorting indicators to sortable header columns in - // the default header row - return; - } + boolean sortable = column.isSortable(); Element cellElement = cell.getElement(); + if (sortable) { + cellElement.addClassName("sortable"); + } + + if (!sortable || sortingOrder == null) { + // Only apply sorting indicators to sortable header columns + return; + } + if (SortDirection.ASCENDING == sortingOrder.getDirection()) { cellElement.addClassName("sort-asc"); } else { @@ -5656,6 +5664,7 @@ public class Grid<T> extends ResizeComposite implements cellElement.removeAttribute("sort-order"); cellElement.removeClassName("sort-desc"); cellElement.removeClassName("sort-asc"); + cellElement.removeClassName("sortable"); } @Override |