Skip to content

Commit 98401ae

Browse files
committed
[add] getSortingStates() method page for data/treecollection
1 parent 46b5453 commit 98401ae

File tree

3 files changed

+93
-0
lines changed

3 files changed

+93
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
sidebar_label: getSortingStates()
3+
title: JavaScript DataCollection - getSortingStates Method
4+
description: You can explore the getSortingStates method of DataCollection in the documentation of the DHTMLX JavaScript UI library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Suite.
5+
---
6+
7+
# getSortingStates()
8+
9+
@short: returns an array of objects with the current parameters of sorting applied to the data
10+
11+
:::note
12+
The method allows sorting data by multiple columns.
13+
:::
14+
15+
## Usage
16+
17+
~~~jsx
18+
interface ISortingState {
19+
by?: string | number, // the id of a data field (a column of Grid) to sort by
20+
dir?: "asc" | "desc", // the direction of sorting: "asc" or "desc"
21+
as?: (a) => any, // a custom function of converting values before comparing
22+
rule?: (a, b) => number, // a custom sorting function
23+
smartSorting?: boolean // (if can be applied) specifies whether a sorting rule should be applied each time after changing the data set
24+
}
25+
26+
getSortingStates(): ISortingState[];
27+
~~~
28+
29+
@returns:
30+
An array of objects with the current parameters of sorting applied to the data.
31+
32+
@example:
33+
const state = grid.data.getSortingStates();
34+
// -> [{by: "country", dir: "desc"}, {by: "population", dir: "desc"},]
35+
36+
@descr:
37+
The return object includes the following properties:
38+
39+
- `by` - (*string|number*) the id of a data field (a column of Grid) to sort by
40+
- `dir` - (*"asc"|"desc"*) the direction of sorting: "asc" or "desc"
41+
- `as` - (*function*) a custom function of converting values before comparing
42+
- `rule` - (*function*) a custom sorting function
43+
- `smartSorting` - (*boolean*) (if can be applied) specifies whether a sorting rule should be applied each time after changing the data set
44+
45+
@changelog:
46+
added in v9.1
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
sidebar_label: getSortingStates()
3+
title: JavaScript TreeCollection - getSortingStates Method
4+
description: You can explore the getSortingStates method of TreeCollection in the documentation of the DHTMLX JavaScript UI library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Suite.
5+
---
6+
7+
# getSortingStates()
8+
9+
@short: returns an array of objects with the current parameters of sorting applied to the data
10+
11+
:::note
12+
The method allows sorting data by multiple columns.
13+
:::
14+
15+
## Usage
16+
17+
~~~jsx
18+
interface ISortingState {
19+
by?: string | number, // the id of a data field (a column of Grid) to sort by
20+
dir?: "asc" | "desc", // the direction of sorting: "asc" or "desc"
21+
as?: (a) => any, // a custom function of converting values before comparing
22+
rule?: (a, b) => number, // a custom sorting function
23+
smartSorting?: boolean // (if can be applied) specifies whether a sorting rule should be applied each time after changing the data set
24+
}
25+
26+
getSortingStates(): ISortingState[];
27+
~~~
28+
29+
@returns:
30+
An array of objects with the current parameters of sorting applied to the data.
31+
32+
@example:
33+
const state = component.data.getSortingStates();
34+
35+
@descr:
36+
The return object includes the following properties:
37+
38+
- `by` - (*string|number*) the id of a data field (a column of Grid) to sort by
39+
- `dir` - (*"asc"|"desc"*) the direction of sorting: "asc" or "desc"
40+
- `as` - (*function*) a custom function of converting values before comparing
41+
- `rule` - (*function*) a custom sorting function
42+
- `smartSorting` - (*boolean*) (if can be applied) specifies whether a sorting rule should be applied each time after changing the data set
43+
44+
@changelog:
45+
added in v9.1

sidebars.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4569,6 +4569,7 @@ module.exports = {
45694569
"data_collection/api/datacollection_getinitialdata_method",
45704570
"data_collection/api/datacollection_getitem_method",
45714571
"data_collection/api/datacollection_getlength_method",
4572+
"data_collection/api/datacollection_getsortingstates_method",
45724573
"data_collection/api/datacollection_group_method",
45734574
"data_collection/api/datacollection_isdataloaded_method",
45744575
"data_collection/api/datacollection_isgrouped_method",
@@ -4770,6 +4771,7 @@ module.exports = {
47704771
"tree_collection/api/treecollection_getlength_method",
47714772
"tree_collection/api/treecollection_getparent_method",
47724773
"tree_collection/api/treecollection_getroot_method",
4774+
"tree_collection/api/treecollection_getsortingstates_method",
47734775
"tree_collection/api/treecollection_haveitems_method",
47744776
"tree_collection/api/treecollection_issaved_method",
47754777
"tree_collection/api/treecollection_load_method",

0 commit comments

Comments
 (0)