Skip to content

Commit 8c9d990

Browse files
authored
Merge pull request #16 from DHTMLX/mr-update-datacollection-api-4736
2 parents d7ddc11 + b3ca733 commit 8c9d990

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

docs/data_collection/api/datacollection_foreach_method.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: You can explore the forEach method of DataCollection in the documen
1111
@signature: {'forEach(callback: (item: object, index?: number, array?: object[]) => any): void;'}
1212

1313
@params:
14-
- `callback: function` - a function that will iterate over items of a data collection. The function takes three parameters:
14+
- `callback: function` - a function that will iterate over items of a data collection. The function is called with the following parameters:
1515
- `item` - (required) the object of an item
1616
- `index` - (optional) the index of an item
1717
- `array` - (optional) an array with items

docs/data_collection/api/datacollection_map_method.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,21 @@ description: You can explore the map method of DataCollection in the documentati
88

99
@short: iterates through all items of the component
1010

11-
@signature: {'map(callback: function): object[];'}
11+
@signature: {'map(callback: (item: object, index?: number, array?: object[]) => any): object[];'}
1212

1313
@params:
14-
- `callback: function` - a function that will be called for each item of a component
14+
- `callback: function` - a function that will be called for each item of a component. The function is called with the following parameters:
15+
- `item` - (required) the object of an item
16+
- `index` - (optional) the index of an item
17+
- `array` - (optional) an array with items
1518

1619
@returns:
1720
A new array of items where each item is the result of the callback function.
1821

1922
@example:
2023
//getting ids of all items of the component
21-
component.data.map(function(item){
22-
return item;
24+
component.data.map(function(item, index, array){
25+
return item.id;
2326
});
2427

2528
@descr:

docs/data_collection/api/datacollection_maprange_method.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,23 @@ description: You can explore the mapRange method of DataCollection in the docume
66

77
# mapRange()
88

9-
@short: returns a new array of the items correspond to the specified parameters
9+
@short: returns a new array of the items according to the specified parameters
1010

11-
@signature: {'mapRange(from: number, to: number, callback: function): object[];'}
11+
@signature: {'mapRange(from: number, to: number, callback: (item: object, index?: number, array?: object[]) => any): object[];'}
1212

1313
@params:
1414
- `from: number` - the initial position of an item in the range
1515
- `to: number` - the final position of an item in the range
16-
- `callback: function` - a function that will be called for each item from the specified range
16+
- `callback: function` - a function that will be called for each item from the specified range. The function is called with the following parameters:
17+
- `item` - (required) the object of an item
18+
- `index` - (optional) the index of an item
19+
- `array` - (optional) an array with items
1720

1821
@returns:
1922
A new array of matching item objects.
2023

2124
@example:
22-
const result = component.data.mapRange(0, 20, function(item, index) {
25+
const result = component.data.mapRange(0, 20, function(item, index, array) {
2326
console.log(item.id, index);
2427
});
2528

docs/tree_collection/api/treecollection_removeall_method.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ description: You can explore the removeAll method of TreeCollection in the docum
66

77
# removeAll()
88

9-
@short: clears the component of all controls
9+
@short: removes all items in the target branch
1010

11-
@signature: {'removeAll(): void;'}
11+
@signature: {'removeAll(id: string | number): void;'}
12+
13+
@params:
14+
15+
- `id: string | number` - the id of the branch
1216

1317
@example:
14-
toolbar.data.removeAll();
18+
toolbar.data.removeAll(id);
1519

1620
@descr:

0 commit comments

Comments
 (0)