This question is locked. New answers and comments are not allowed.
Hi all,
I am trying to create a tree view that remembers it's state (e.g. what items have been expanded/checked etc.) by storing node values in a cookie. When I initially load the tree view and restore it's state I have no issues, however I am experiencing problems after the tree has been restored.
If I check a collapsed node in the tree view and then expand it (uses an AJAX call to server) the child nodes are duplicated. Using firebug I can confirm the following is not happening:
- Double server call
- Double JSON value being returned
This has lead me here, since I'm starting to think there could be an issue with the tree view itself?
Here is my code to handle the onCheck() callback:
Let me know if you need anymore info. Any help is greatly appreciated.
Thanks.
I am trying to create a tree view that remembers it's state (e.g. what items have been expanded/checked etc.) by storing node values in a cookie. When I initially load the tree view and restore it's state I have no issues, however I am experiencing problems after the tree has been restored.
If I check a collapsed node in the tree view and then expand it (uses an AJAX call to server) the child nodes are duplicated. Using firebug I can confirm the following is not happening:
- Double server call
- Double JSON value being returned
This has lead me here, since I'm starting to think there could be an issue with the tree view itself?
Here is my code to handle the onCheck() callback:
_onChecked = function (e) { var t = element.data('tTreeView'); // Get Parent and Child Nodes to check var parentNodeID = t.getItemValue(e.item); var childNodes = $(e.item).find('li'); // Add the nodes to check to an array, // this array is added to the state cookie var nodesToCheck = []; nodesToCheck.push(parentNodeID); // All children nodes must have the same checked value as their parent var parentCheckValue = $(e.item).find('div:first > span[class="t-checkbox"] > input[type="checkbox"]').is(':checked'); if (childNodes.length > 0) { $(childNodes).each(function (i, v) { var nodeID = $(v).find('div:first > input[type="hidden"]').val(); // Check the node t.nodeCheck(v, parentCheckValue); // Add node to state array nodesToCheck.push(nodeID); }) } // Send state array to Node Manager to store node state in cookie NodeManager.checkNodes(nodesToCheck); };Let me know if you need anymore info. Any help is greatly appreciated.
Thanks.