Hi, I would like to know if the UltraWinTree has a method similar to the grid's UpdateData so I can commit changes to the node of the tree during the AfterCellExitEditMode. I'm doing this because I would not like user to be able to update multiple columns of the tree and then hit escape twice and undo all their changes. Thanks
Thanks Mike for being so helpful
Hi,
I think you might be going about this the wrong way. I'm pretty sure that the data is written from the tree to the data source as soon as you leave the cell, anyway. So calling Update in this case will do nothing because the Update has already completed. The undo of the entire row of data is done by the data source using the IEditableObject interface.
If you don't want the user to be able to do this by pressing Escape, I think you can achieve this by removing the appropriate KeyActionMapping from the tree.
private void Form1_Load(object sender, EventArgs e) { // Loop through the collection backward so that removing an item doesn't cause any // problems with the loop. for (int i = this.ultraTree1.KeyActionMappings.Count - 1; i >= 0; i--) { TreeKeyActionMapping treeKeyActionMapping = this.ultraTree1.KeyActionMappings[i]; if (treeKeyActionMapping.ActionCode == UltraTreeAction.UndoNodeEdit) this.ultraTree1.KeyActionMappings.Remove(treeKeyActionMapping); } }
I'm doing it on the AfterCellExitEditMode of the WinTree. I've attached an example. What I'm doing is just updating 2 of the check boxes on the same line and hitting escape twice and both edits are going away. Preferably I would like the escape only to undo the changes of the current cell. Thanks
In what event are you calling those methods? They should work.
Thanks Mike, but I've tried calling Update and also PerformAction(UltraTreeAction.ExitEditModeOnCellSaveChanges) but to no avail. The only way I get the data to be committed is if I move to another row or move focus out of the tree. Any other recommendations?