TreeGrid v6.0
Undo & Redo
<Cfg> bool Undo [0] upd 7.0 .
If set to 1, TreeGrid supports Undo/UndoAll and Redo/RedoAll actions, by default for CtrlZ and CtrlY events.
TreeGrid buffers all modifications since last save or reload. For server paging the buffer is cleared by any action reloading body like sort or filter.
Undo undoes the last unsaved modification. Modifications are change cell value, delete row, add row, move row, copy row.
(Since 7.0) Next modifications are change Def by ChangeDef, change attribute by SetAttribute.
(Since 7.0) If set <Cfg DynamicSpan=’1’, also span cell, split cell and move column can be undone.
Undo does not affect changes in Filter row and rows with NoUpload=’1’ (by default Group, Search, Tabber, Toolbar)
Undo is not compatible with AutoUpload.
<I> bool NoUpload [0/1] .
If set to 1, ignores changes in this row and does not upload them to server.
If set to 1, it also does not save undo for changed cells except the cell has set Undo=’1’.
Default value is 0 for data rows and 1 for space rows.
Filter row has always set 1.
<cell> bool Undo [0/1] new 6.4 .
If the change in cell will be saved to undo list and can be undone.
By default it is set 1 for data rows and 0 for space rows. Exactly default value is set to !NoUpload.
Filter row cells have always set 0.
<Actions> Undo Attached to event OnCtrlZ and OnClickButtonUndo .
Undoes the last grid modification (cell change, add row, delete row(s), move row(s), copy row(s)).
<Actions> UndoAll Not attached to any event .
Undoes all modifications done since last save or accepting changes or reloading body or grid
<Actions> Redo Attached to event OnCtrlY and OnClickButtonRedo .
Does again the last undone action. It can be done only when between Undo and Redo was not done any other modification.
<Actions> RedoAll Not attached to any event .
Does again all undone actions. It can be done only when between Undo and Redo was not done any other modification.
<Actions> ClearUndo Not attached to any event .
Clears undo buffer.
Remember, the undo buffer is cleared automatically on save or reload or reload body.
API method bool CanUndo ( ) new 6.3 .
Returns true, if there is something to undo
API method bool CanRedo ( ) new 6.3 .
Returns true, if there is something to redo
API method void StartUndo ( ) new 7.0 .
Starts new undo block.
Call it before doing more changes in grid to be undone all at once
The undo blocks can be nested. But the count of calling StartUndo must be the same as count of calling EndUndo.
API method void EndUndo ( ) new 7.0 .
Ends new undo block.
Call it after doing more changes in grid to be undone all at once
API method void CustomUndo (object Object, function Undo, function Redo) new 7.0 .
Adds into undo queue custom undo action.
The Object should contain all information you require to do both undo and redo actions.
On undo is called Undo(Object), on redo is called Redo(Object). Or is possible also to use OnUndo / OnRedo API events.
API method void OnUndo (TGrid grid, string action, .... ) new 7.0 .
Called after given action is undone by clicking Undo button or Ctrl + Z. action:
“Start” OnUndo (TGrid grid, string action) Called before block of undo actions starts, but undo is already disabled
“End” OnUndo (TGrid grid, string action) Called after block of undo actions finishes, but before undo is enabled
“Change” OnUndo (TGrid grid, string action, TRow row, string col, type value) After cell changed to original value
“Add” OnUndo (TGrid grid, string action, TRow row, TRow src) After added or copied row is deleted, but before it is removed
“Delete” OnUndo (TGrid grid, string action, TRow row) After deleted row is undeleted or undeleted row is deleted
“Move” OnUndo (TGrid grid, string action, TRow row, TRow parent, TRow next) After moved row is moved to original position
“Span” OnUndo (TGrid grid, TRow row1, string col1, TRow row2, string col2) After spanned cell is split back
“Split” OnUndo (TGrid grid, TRow row1, string col1, TRow row2, string col2) After split cell is spanned back
“MoveCol” OnUndo (TGrid grid, string col, string tocol, string rightcol) After moved column is moved back to original position (if set DynamicSpan=’1’)
“ChangeDef” OnUndo (TGrid grid, string action, TRow row, string def) After row Def attribute is changed back to original value
“SetAttribute” OnUndo (TGrid grid, string action, TRow row, string col, string attr, type value) After the attribute set by SetAttribute method changed to original value
“Custom” OnUndo (TGrid grid, string action, object Object) After undo of custom undo set by CustomUndo
API method void OnRedo (TGrid grid, string action, .... ) new 7.0 .
Called after given action is undone by clicking Undo button or Ctrl + Z. action:
“Start” OnRedo (TGrid grid, string action) Called before block of undo actions starts, but undo is already disabled
“End” OnRedo (TGrid grid, string action) Called after block of undo actions finishes, but before undo is enabled
“Change” OnRedo (TGrid grid, string action, TRow row, string col, type value) After cell changed to new value
“Add” OnRedo (TGrid grid, string action, TRow row, TRow src) After the row is added or copied
“Delete” OnRedo (TGrid grid, string action, TRow row) After the row is deleted or undeleted
“Move” OnRedo (TGrid grid, string action, TRow row, TRow parent, TRow next) After the row is moved to new position
“Span” OnRedo (TGrid grid, TRow row1, string col1, TRow row2, string col2) After cells are spanned
“Split” OnRedo (TGrid grid, TRow row1, string col1, TRow row2, string col2) After cells are split
“MoveCol” OnRedo (TGrid grid, string col, string tocol, string rightcol) After column is moved to new position (if set DynamicSpan=’1’)
“ChangeDef” OnRedo (TGrid grid, string action, TRow row, string def) After row Def attribute is changed to new value
“SetAttribute” OnRedo (TGrid grid, string action, TRow row, string col, string attr, type value) After the attribute set by SetAttribute method changed to new value
“Custom” OnUndo (TGrid grid, string action, object Object) After redo of custom undo set by CustomUndo