You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type ActionType ="add"|"remove"|"removeAll"|"change";
20
+
21
+
interface IAction {
22
+
type: ActionType;
23
+
batch: IRow[];
24
+
inverse?: IAction;
25
+
}
26
+
27
+
beforeAdd: (action:IAction) => boolean |void;
28
+
~~~
16
29
17
30
@params:
18
31
The callback of the event is called with the following parameters:
19
-
-`action: IAction` - the action object to be added containing:
20
-
-`type: ActionType` - the type of action: "add", "remove", "removeAll", or "change"
21
-
-`batch: IRow[]` - an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)
22
-
-`inverse?: IAction` - the inverse action required for undoing (for the "change" and "removeAll" types)
32
+
33
+
<table>
34
+
<tbody>
35
+
<tr>
36
+
<td><b>action</b></td>
37
+
<td>(<i>object</i>) the action object to be added that contains the following properties:<ul><li><b>`type`</b> - (<i>string</i>) the type of action: "add", "remove", "removeAll", or "change"</li><li><b>`batch`</b> - (<i>array</i>) an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)</li><li><b>`inverse`</b> - (<i>object</i>) optional, the inverse action required for undoing (mandatory for the "change" and "removeAll" types, not required for other types)</li></ul></td>
type ActionType ="add"|"remove"|"removeAll"|"change";
19
+
20
+
interface IAction {
21
+
type: ActionType;
22
+
batch: IRow[];
23
+
inverse?: IAction;
24
+
}
25
+
26
+
beforeRedo: (action:IAction) => boolean |void;
27
+
~~~
16
28
17
29
@params:
18
30
The callback of the event is called with the following parameters:
19
-
-`action: IAction` - the action object from the redo stack containing:
20
-
-`type: ActionType` - the type of action: "add", "remove", "removeAll", or "change"
21
-
-`batch: IRow[]` - an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)
22
-
-`inverse?: IAction` - the inverse action required for undoing (for the "change" and "removeAll" types)
31
+
32
+
<table>
33
+
<tbody>
34
+
<tr>
35
+
<td><b>action</b></td>
36
+
<td>(<i>object</i>) the action object from the redo stack that contains the following properties:<ul><li><b>`type`</b> - (<i>string</i>) the type of action: "add", "remove", "removeAll", or "change"</li><li><b>`batch`</b> - (<i>array</i>) an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)</li><li><b>`inverse`</b> - (<i>object</i>) optional, the inverse action required for undoing (mandatory for the "change" and "removeAll" types, not required for other types)</li></ul></td>
type ActionType ="add"|"remove"|"removeAll"|"change";
19
+
20
+
interface IAction {
21
+
type: ActionType;
22
+
batch: IRow[];
23
+
inverse?: IAction;
24
+
}
25
+
26
+
beforeUndo: (action:IAction) => boolean |void;
27
+
~~~
16
28
17
29
@params:
18
30
The callback of the event is called with the following parameters:
19
-
-`action: IAction` - the action object containing:
20
-
-`type: ActionType` - the type of action: "add", "remove", "removeAll", or "change"
21
-
-`batch: IRow[]` - an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)
22
-
-`inverse?: IAction` - the inverse action required for undoing (for the "change" and "removeAll" types)
31
+
32
+
<table>
33
+
<tbody>
34
+
<tr>
35
+
<td><b>action</b></td>
36
+
<td>(<i>object</i>) the action object that contains the following properties:<ul><li><b>`type`</b> - (<i>string</i>) the type of action: "add", "remove", "removeAll", or "change"</li><li><b>`batch`</b> - (<i>array</i>) an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)</li><li><b>`inverse`</b> - (<i>object</i>) optional, the inverse action required for undoing (mandatory for the "change" and "removeAll" types, not required for other types)</li></ul></td>
Copy file name to clipboardExpand all lines: docs/grid/api/history/error_event.md
+26-6Lines changed: 26 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,15 +16,35 @@ This functionality requires PRO version of the DHTMLX Grid (or DHTMLX Suite) pac
16
16
The event is triggered when an error occurs, such as the module is disabled, the history is empty, the action type is invalid, or the inverse action is missing for the `undo` operation.
The callback of the event is called with the following parameters:
23
-
-`error` - the error message
24
-
-`action: IAction` - the action object associated with the error, or `null`. The `action` object contains the following properties:
25
-
-`type: ActionType` - the type of action: "add", "remove", "removeAll", or "change"
26
-
-`batch: IRow[]` - an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)
27
-
-`inverse?: IAction` - the inverse action required for undoing (for the "change" and "removeAll" types)
35
+
36
+
<table>
37
+
<tbody>
38
+
<tr>
39
+
<td><b>error</b></td>
40
+
<td>(<i>string</i>) the error message</td>
41
+
</tr>
42
+
<tr>
43
+
<td><b>action</b></td>
44
+
<td>(<i>object</i>) the action object associated with the error, or `null`. It contains the following properties:<ul><li><b>`type`</b> - (<i>string</i>) the type of action: "add", "remove", "removeAll", or "change"</li><li><b>`batch`</b> - (<i>array</i>) an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)</li><li><b>`inverse`</b> - (<i>object</i>) optional, the inverse action required for undoing (for the "change" and "removeAll" types)</li></ul></td>
Copy file name to clipboardExpand all lines: docs/grid/api/history/gethistory_method.md
+23-5Lines changed: 23 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,13 +12,31 @@ This functionality requires PRO version of the DHTMLX Grid (or DHTMLX Suite) pac
12
12
13
13
@short: returns a copy of the array of all actions in the Grid history to prevent accidental modification of the internal structure
14
14
15
-
@signature: {'getHistory(): IAction[];'}
15
+
### Usage
16
+
17
+
~~~jsx
18
+
type ActionType ="add"|"remove"|"removeAll"|"change";
19
+
20
+
interface IAction {
21
+
type: ActionType;
22
+
batch: IRow[];
23
+
inverse?: IAction;
24
+
}
25
+
26
+
getHistory(): IAction[];
27
+
~~~
16
28
17
29
@returns:
18
-
Returns a copy of the array of all actions in the history. Each `action` object may contain:
19
-
- `type: ActionType` - the type of action: "add", "remove", "removeAll", or "change"
20
-
- `batch: IRow[]` - an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)
21
-
- `inverse?: IAction` - the inverse action required for undoing
30
+
Returns a copy of the array of all actions in the Grid history, where each action presents an object described below:
31
+
32
+
<table>
33
+
<tbody>
34
+
<tr>
35
+
<td><b>action</b></td>
36
+
<td>(<i>object</i>) the action object that contains the following properties:<ul><li><b>`type`</b> - (<i>string</i>) the type of action: "add", "remove", "removeAll", or "change"</li><li><b>`batch`</b> - (<i>array</i>) an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)</li><li><b>`inverse`</b> - (<i>object</i>) optional, the inverse action required for undoing (for the "change" and "removeAll" types)</li></ul></td>
Copy file name to clipboardExpand all lines: docs/grid/usage_history.md
+18-8Lines changed: 18 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -140,10 +140,14 @@ For the "change" and "removeAll" actions, an `inverse` action is mandatory. Othe
140
140
141
141
You can add a new action into the history of actions within the grid by using the [`add()`](grid/api/history/add_method.md) method of the `history` object. The method takes the following parameters:
142
142
143
-
-`action: IAction` - the action object containing:
144
-
-`type: ActionType` - the type of action: "add", "remove", "removeAll", or "change"
145
-
-`batch: IRow[]` - an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)
146
-
-`inverse?: IAction` - the inverse action required for undoing (mandatory for the "change" and "removeAll" types, not required for other types)
143
+
<table>
144
+
<tbody>
145
+
<tr>
146
+
<td><b>action</b></td>
147
+
<td>(<i>object</i>) the action object that contains the following properties:<ul><li><b>`type`</b> - (<i>string</i>) the type of action: "add", "remove", "removeAll", or "change"</li><li><b>`batch`</b> - (<i>array</i>) an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)</li><li><b>`inverse`</b> - (<i>object</i>) optional, the inverse action required for undoing (mandatory for the "change" and "removeAll" types, not required for other types)</li></ul></td>
148
+
</tr>
149
+
</tbody>
150
+
</table>
147
151
148
152
:::note
149
153
The `action` argument must conform to the `IAction` interface. If the module is disabled, the action type is invalid, or the `inverse` property is missing (for actions with the "change" and "removeAll" types), the [`error`](grid/api/history/error_event.md) event is triggered.
@@ -397,10 +401,16 @@ To make the process of working with the undo/redo operations more flexible, you
397
401
398
402
You can get a copy of the array of all actions in the Grid history using the [`getHistory()`](grid/api/history/gethistory_method.md) method of the `history` object to prevent accidental modification of the internal structure.
399
403
400
-
Each `action` object in the returned array may contain the following properties:
401
-
- `type: ActionType` - the type of action: "add", "remove", "removeAll", or "change"
402
-
- `batch: IRow[]` - an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)
403
-
- `inverse?: IAction` - the inverse action required for undoing (for the "change" and "removeAll" types)
404
+
Each action in the returned array presents an object described below:
405
+
406
+
<table>
407
+
<tbody>
408
+
<tr>
409
+
<td><b>action</b></td>
410
+
<td>(<i>object</i>) the action object that contains the following properties:<ul><li><b>`type`</b> - (<i>string</i>) the type of action: "add", "remove", "removeAll", or "change"</li><li><b>`batch`</b> - (<i>array</i>) an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)</li><li><b>`inverse`</b> - (<i>object</i>) optional, the inverse action required for undoing (for the "change" and "removeAll" types)</li></ul></td>
0 commit comments