Skip to content

Commit 4b13f36

Browse files
committed
[update] data sorting api and guide
1 parent 98401ae commit 4b13f36

File tree

8 files changed

+63
-66
lines changed

8 files changed

+63
-66
lines changed

docs/data_collection/api/datacollection_getsortingstates_method.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description: You can explore the getSortingStates method of DataCollection in th
99
@short: returns an array of objects with the current parameters of sorting applied to the data
1010

1111
:::note
12-
The method allows sorting data by multiple columns.
12+
The method allows getting the result of sorting data by multiple columns.
1313
:::
1414

1515
## Usage
@@ -31,10 +31,10 @@ An array of objects with the current parameters of sorting applied to the data.
3131

3232
@example:
3333
const state = grid.data.getSortingStates();
34-
// -> [{by: "country", dir: "desc"}, {by: "population", dir: "desc"},]
34+
// -> [{by: "country", dir: "desc"}, {by: "population", dir: "desc"}]
3535

3636
@descr:
37-
The return object includes the following properties:
37+
The return array contains objects with the following properties:
3838

3939
- `by` - (*string|number*) the id of a data field (a column of Grid) to sort by
4040
- `dir` - (*"asc"|"desc"*) the direction of sorting: "asc" or "desc"

docs/grid/api/api_overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ description: You can explore the API of Grid in the documentation of the DHTMLX
2121
| [](grid/api/grid_getcolumn_method.md) | @getshort(grid/api/grid_getcolumn_method.md) |
2222
| [](grid/api/grid_getheaderfilter_method.md) | @getshort(grid/api/grid_getheaderfilter_method.md) |
2323
| [](grid/api/grid_getscrollstate_method.md) | @getshort(grid/api/grid_getscrollstate_method.md) |
24-
| [](grid/api/grid_getsortingstate_method.md) | @getshort(grid/api/grid_getsortingstate_method.md) |
2524
| [](grid/api/grid_getspan_method.md) | @getshort(grid/api/grid_getspan_method.md) |
2625
| [](grid/api/grid_getsummary_method.md) | @getshort(grid/api/grid_getsummary_method.md) |
2726
| [](grid/api/grid_hidecolumn_method.md) | @getshort(grid/api/grid_hidecolumn_method.md) |
@@ -191,6 +190,7 @@ description: You can explore the API of Grid in the documentation of the DHTMLX
191190
| [](grid/api/grid_keynavigation_config.md) | @getshort(grid/api/grid_keynavigation_config.md) |
192191
| [](grid/api/grid_leftsplit_config.md) | @getshort(grid/api/grid_leftsplit_config.md) |
193192
| [](grid/api/grid_multiselection_config.md) | @getshort(grid/api/grid_multiselection_config.md) |
193+
| [](grid/api/grid_multisort_config.md) | @getshort(grid/api/grid_multisort_config.md) |
194194
| [](grid/api/grid_resizable_config.md) | @getshort(grid/api/grid_resizable_config.md) |
195195
| [](grid/api/grid_rightsplit_config.md) | @getshort(grid/api/grid_rightsplit_config.md) |
196196
| [](grid/api/grid_rowcss_config.md) | @getshort(grid/api/grid_rowcss_config.md) |

docs/grid/api/grid_getsortingstate_method.md

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
sidebar_label: multiSort
3+
title: JavaScript Grid - multiSort Config
4+
description: You can explore the multiSort config of Grid 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+
# multiSort
8+
9+
@short: Optional. Enables the possibility of sorting Grid data by multiple columns
10+
11+
:::tip Pro version only
12+
This functionality is available in the PRO edition only.
13+
:::
14+
15+
@signature: {'multiSort?: boolean;'}
16+
17+
@default: true
18+
19+
@example:
20+
const grid = new dhx.Grid("grid_container", {
21+
columns: [
22+
// columns config
23+
],
24+
multiSort: false,
25+
data: dataset
26+
});
27+
28+
@descr:
29+
30+
**Related sample**: [Grid. Sorting by multiple columns (multisorting)](https://snippet.dhtmlx.com/4ej0i3qi)

docs/grid/usage.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -351,25 +351,19 @@ grid.data.sort({
351351

352352
#### Getting the sorting state
353353

354-
To get the current state of sorting data in Grid, use the [](grid/api/grid_getsortingstate_method.md) method. The method returns an object with two attributes:
354+
To get the current state of sorting data in Grid, use the [`getSortingStates()`](data_collection/api/datacollection_getsortingstates_method.md) method of DataCollection. The method returns an object with the following properties:
355355

356-
<table>
357-
<tbody>
358-
<tr>
359-
<td><b>dir</b></td>
360-
<td>(<i>string</i>) the sorting direction (desc, asc)</td>
361-
</tr>
362-
<tr>
363-
<td><b>by</b></td>
364-
<td>(<i>string | number</i>) the id of a column that the grid is sorted by</td>
365-
</tr>
366-
</tbody>
367-
</table>
368-
<br/>
356+
- `by` - (*string|number*) the id of a data field (a column of Grid) to sort by
357+
- `dir` - (*"asc"|"desc"*) the direction of sorting: "asc" or "desc"
358+
- `as` - (*function*) a custom function of converting values before comparing
359+
- `rule` - (*function*) a custom sorting function
360+
- `smartSorting` - (*boolean*) (if can be applied) specifies whether a sorting rule should be applied each time after changing the data set
369361

370-
~~~js
371-
const state = grid.getSortingState();
372-
// -> { dir: "desc", by: "country" }
362+
The method allows getting the result of sorting data by multiple columns.
363+
364+
~~~jsx
365+
const state = grid.data.getSortingStates();
366+
// -> [{by: "country", dir: "desc"}, {by: "population", dir: "desc"}]
373367
~~~
374368

375369
**Related sample**: [Grid. Get sorting state](https://snippet.dhtmlx.com/u2vk3ri3)

docs/migration.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@ description: You can explore how to migrate to newer versions in the documentati
66

77
# Migration to newer versions
88

9+
9.0 -> 9.1
10+
-----------
11+
12+
### Grid
13+
14+
The `getSortingState()` method of Grid has been deprecated and replaced with the `getSortingStates()` method of [DataCollection](/data_collection/) and [TreeCollection](/tree_collection/):
15+
16+
~~~jsx title="Before v9.1"
17+
grid.getSortingState();
18+
~~~
19+
20+
~~~jsx title="From v9.1"
21+
grid.data.getSortingStates()[0]; // getting the first (main) sorting state
22+
~~~
23+
924
8.4 -> 9.0
1025
-----------
1126

docs/tree_collection/api/treecollection_getsortingstates_method.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description: You can explore the getSortingStates method of TreeCollection in th
99
@short: returns an array of objects with the current parameters of sorting applied to the data
1010

1111
:::note
12-
The method allows sorting data by multiple columns.
12+
The method allows getting the result of sorting data by multiple columns.
1313
:::
1414

1515
## Usage
@@ -33,7 +33,7 @@ An array of objects with the current parameters of sorting applied to the data.
3333
const state = component.data.getSortingStates();
3434

3535
@descr:
36-
The return object includes the following properties:
36+
The return array contains objects with the following properties:
3737

3838
- `by` - (*string|number*) the id of a data field (a column of Grid) to sort by
3939
- `dir` - (*"asc"|"desc"*) the direction of sorting: "asc" or "desc"

sidebars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2496,7 +2496,6 @@ module.exports = {
24962496
]
24972497
},
24982498
"grid/api/grid_getscrollstate_method",
2499-
"grid/api/grid_getsortingstate_method",
25002499
"grid/api/grid_getspan_method",
25012500
"grid/api/grid_getsummary_method",
25022501
"grid/api/grid_hidecolumn_method",
@@ -2631,6 +2630,7 @@ module.exports = {
26312630
"grid/api/grid_keynavigation_config",
26322631
"grid/api/grid_leftsplit_config",
26332632
"grid/api/grid_multiselection_config",
2633+
"grid/api/grid_multisort_config",
26342634
"grid/api/grid_resizable_config",
26352635
"grid/api/grid_rightsplit_config",
26362636
"grid/api/grid_rowcss_config",

0 commit comments

Comments
 (0)