Skip to content

Commit cd19b46

Browse files
committed
[fix] corrections in data/treecollection sort() examples
1 parent 944ef1a commit cd19b46

6 files changed

+28
-34
lines changed

docs/data_collection/api/datacollection_filter_method.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ description: You can explore the filter method of DataCollection in the document
1414
- `rule: function | object` - the filtering criteria
1515
- If set as a *function*, filtering will be applied by the rule specified in the function. The function takes an object of a data item as a parameter and returns *true/false*
1616
- If set as an *object*, the parameter has the following attributes:
17-
- `by: string | number` - mandatory, the id of a data field (the column of Grid)
17+
- `by: string | number` - mandatory, the id of a data field
1818
- `match: string` - mandatory, a pattern to match
1919
- `compare: function` - optional, a function for extended filtering that takes three parameters:
20-
- `value` - the value to compare (e.g. a column in a row for Grid)
20+
- `value` - the value to compare
2121
- `match` - a pattern to match
22-
- `item` - a data item the values of which should be compared (e.g. a row)
22+
- `item` - a data item the values of which should be compared
2323
- `config: object` - optional, defines the parameters of filtering. It may contain the following properties:
2424
- `id: string` - optional, the id of the filter
2525
- `add: boolean` - optional, defines whether each next filtering will be applied to the already filtered data (<i>true</i>), or to the initial data (<i>false</i>, default)

docs/data_collection/api/datacollection_getfilters_method.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ description: You can explore the getFilters method of DataCollection in the docu
1515
- `permanent: boolean` - optional, <i>false</i> by default. Allows getting the list of permanent filters
1616

1717
@returns:
18-
- `filters: object` - an object with the applied filters, where the key is the id of a filter and the value is an object with the [**rule** and **config** properties](data_collection/api/datacollection_filter_method.md)
18+
- `filters: object` - an object with the applied filters, where the key is the id of a filter and the value is an object with the [`rule` and `config` properties](data_collection/api/datacollection_filter_method.md)
1919

2020
@example:
2121
const filters = grid.data.getFilters();

docs/data_collection/api/datacollection_getsortingstates_method.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The array returned by the method contains objects with the following properties:
3636
<tbody>
3737
<tr>
3838
<td><b>by</b></td>
39-
<td>(<i>string | number</i>) the id of a data field (a column of Grid) to sort by</td>
39+
<td>(<i>string | number</i>) the id of a data field to sort by</td>
4040
</tr>
4141
<tr>
4242
<td><b>dir</b></td>

docs/data_collection/api/datacollection_sort_method.md

+8-10
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,22 @@ description: You can explore the sort method of DataCollection in the documentat
1212

1313
@params:
1414
- `rule: object` - an object with parameters for sorting. The object has the following attributes:
15-
- `by: string | number` - the id of a data field (a column of Grid)
15+
- `by: string | number` - the id of a data field
1616
- `dir: string` - the direction of sorting: "asc" or "desc"
1717
- `as: function` - a function that specifies the type to sort data as
1818
- `rule: function` - optional, a sorting rule; the function must have two parameters and return a number (-1,0,1)
1919
- `config: object` - defines the parameter of sorting. It may contain one property:
2020
- `smartSorting: boolean` - specifies whether a sorting rule should be applied each time after changing the data set
2121

2222
@example:
23-
grid.data.sort({
24-
by:"a",
25-
dir:"desc",
26-
as: function(item){
27-
return item.toUpperCase();
28-
},
23+
grid.data.sort(
2924
{
30-
smartSorting: true
31-
}
32-
});
25+
by:"a",
26+
dir:"desc",
27+
as: item => (item.toUpperCase())
28+
},
29+
{ smartSorting: true }
30+
);
3331

3432
// cancels the applied sorting rules
3533
grid.data.sort();

docs/grid/usage.md

+8-10
Original file line numberDiff line numberDiff line change
@@ -325,16 +325,14 @@ It is possible to sort data in the grid via the `sort()` method of [DataCollecti
325325
<br/>
326326

327327
~~~jsx
328-
grid.data.sort({
329-
by:"a",
330-
dir:"desc",
331-
as: function(item){
332-
return item.toUpperCase();
333-
},
328+
grid.data.sort(
334329
{
335-
smartSorting: true
336-
}
337-
});
330+
by:"a",
331+
dir:"desc",
332+
as: item => (item.toUpperCase())
333+
},
334+
{ smartSorting: true }
335+
);
338336
~~~
339337

340338
**Related sample**: [Grid. Sorting](https://snippet.dhtmlx.com/81dmbdfd)
@@ -405,7 +403,7 @@ To get the current state of sorting data in Grid, use the [`getSortingStates()`]
405403
<tbody>
406404
<tr>
407405
<td><b>by</b></td>
408-
<td>(<i>string | number</i>) the id of a data field (a column of Grid) to sort by</td>
406+
<td>(<i>string | number</i>) the id of a data field to sort by</td>
409407
</tr>
410408
<tr>
411409
<td><b>dir</b></td>

docs/tree_collection/api/treecollection_sort_method.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@ description: You can explore the sort method of TreeCollection in the documentat
2020
- `smartSorting: boolean` - specifies whether a sorting rule should be applied each time after changing the data set
2121

2222
@example:
23-
component.data.sort({
24-
by: "price",
25-
dir: "asc",
26-
as: function(value){
27-
return value ? value : ""
28-
},
23+
component.data.sort(
2924
{
30-
smartSorting: true
31-
}
32-
});
25+
by: "price",
26+
dir: "asc",
27+
as: value => (value || "")
28+
},
29+
{ smartSorting: true }
30+
);
3331

3432
// cancels the applied sorting rules
3533
component.data.sort();

0 commit comments

Comments
 (0)