We have a problem relative to undoing changes on a TreeList,we don't allow recursive delete on TreeList, so after an user tries to delete a node with children he must receive am alerts and modification should be undone.
Tha problem is cancelChanges() cannot restore node's children the user is triyng to delete.
The TO-BE scenario we need for our application is:
- TreeList is empty
- User inserts Root Node R1
- User inserts Node C1 as child of R1
- User inserts Node D1 as child of C1
- User tries to delete R1
- Server throws exception about user cannot recursively delete nodes ( we don't allow recursive / tree deletions )
- App catch exception in ourTreelist.dataSource.error callback and call ourTreelist.dataSource.cancelChanges()
- following nodes are restored : R1, C1, D1
Example TreeList hierarchy
R1 ( deleting R1 remove cannot be done because it would remove also C1 and D1 )
But in our tests after deleting R1 and receving error from server we cannot use cancelChanges() to entirely restore previous situation, only R1 is restored but children miss.
I attach before (delete) and after (delete) image to explain better