Title: tree after reload, i can't select neither check node Post by: fredk on January 23, 2014, 03:19:42 PM Hi
After reloading the tree, i can't select neither check the node My case is : i select a node, i drop it. I would like to keep the select on the moved node, the one which has change place I also try with the check method, doesn't work after reload method (works well elsewhere) So i feel it's due to the reload ? The basic code is: $('#tt').tree('reload'); $('#tt').tree('select', source.target); $('#tt').tree('check', source.target); I have tried with jquery promise, but it still doesn't work. Example: var reload = $('#tt').tree('reload'); reload.promise().done(function () { var myNode = $('#tt').tree('find', source.id); alert(myNode) //OK, i get my good id //Select the node $('#tt').tree('select', myNode.target); //$('#tt').tree('select', myNode.id); //$('#tt').tree('select', myNode); }); But i make it works elsewhere , where there is no reload. Example: success: function(idResult){ //Find the node with id var nextNode = $('#tt').tree('find', idResult); //Select the node $('#tt').tree('select', nextNode.target); If you have any ideas why and how to solve this Thanks a lot Title: Re: tree after reload, i can't select neither check node Post by: stworthy on January 23, 2014, 07:45:05 PM The tree can remain the 'checked' state during dragging and dropping. But after calling 'reload' method, the 'checked' state will be lost. You need to call 'check' method to check some nodes when reloading data successfully.
Title: Re: tree after reload, i can't select neither check node Post by: fredk on January 24, 2014, 11:11:36 AM Hi
thanks for the answer My first need is to select the node , the check was just a second example to see if i have access or not on the node methods My case is exactly this: I am moving the node position with my keyboard After each move i update the database and ajax:on success, i reload the tree (later i will reload only some nodes , but today, i relaod all) I would like to keep the selection on the node to continue moving it with my keaboard, without re-selecting it with my mouse Do you know why after reloading, i can't use the select method ? I have been testing with a js timer, with promise, but ... i don't get it :( Cheers Title: Re: tree after reload, i can't select neither check node Post by: stworthy on January 25, 2014, 05:44:03 PM You need to store the id value of selected node before calling 'reload' method. When loaded successfully, you have to call 'select' method to select the previous selected node again.
Code: var t = $('#tt'); Title: Re: tree after reload, i can't select neither check node Post by: fredk on January 25, 2014, 05:56:53 PM Great thanks, it works :)
|