summaryrefslogtreecommitdiffstats
path: root/documentation/components
diff options
context:
space:
mode:
authorAleksi Hietanen <aleksi@vaadin.com>2017-02-22 10:38:15 +0200
committerPekka Hyvönen <pekka@vaadin.com>2017-02-22 10:38:15 +0200
commitf48c0f974b58238683f8838ceea8d99dc724c877 (patch)
treed49e30fa6d92d8a24b9c2f2f37ca2f6c96c2745a /documentation/components
parentbba4e4037bbfa7bfd5f71718806a92bb351e2fe8 (diff)
downloadvaadin-framework-f48c0f974b58238683f8838ceea8d99dc724c877.tar.gz
vaadin-framework-f48c0f974b58238683f8838ceea8d99dc724c877.zip
Fix grid column sort order documentation (#8650)
* Fix grid column sort order documentation
Diffstat (limited to 'documentation/components')
-rw-r--r--documentation/components/components-grid.asciidoc16
1 files changed, 6 insertions, 10 deletions
diff --git a/documentation/components/components-grid.asciidoc b/documentation/components/components-grid.asciidoc
index ed118ef726..957a9a7fb4 100644
--- a/documentation/components/components-grid.asciidoc
+++ b/documentation/components/components-grid.asciidoc
@@ -680,19 +680,15 @@ direction)#, which allows specifying the sort direction.
grid.sort(nameColumn, SortDirection.DESCENDING);
----
-To sort on multiple columns, you need to use the fluid sort API with
-[methodname]#sort(Sort)#, which allows chaining sorting rules. Sorting rules are
-created with the static [methodname]#by()# method, which defines the primary
-sort column, and [methodname]#then()#, which can be used to specify any
-secondary sort columns. They default to ascending sort order, but the sort
-direction can be given with an optional parameter.
-
+To sort by multiple columns, you need to use the fluid sort builder API
+[classname]#GridSortOrderBuilder#, which allows you to easily construct sorting information to be passed to grid's [methodname]#setSortOrder()# method.
+A sort builder is created with the static methods [methodname]#asc()# and [methodname]#desc()#,
+and additional sorting information can by chained with [methodname]#thenAsc()# and [methodname]#thenDesc()#.
[source, java]
----
-// Sort first by city and then by name
-grid.sort(Sort.by(cityColumn, SortDirection.ASCENDING)
- .then(nameColumn, SortDirection.DESCENDING));
+// Sort first by city (ascending) and then by name (descending)
+grid.setSortOrder(GridSortOrder.asc(cityColumn).thenDesc(nameColumn))
----