Categories | Question details Back To List | ||||||||
Where can I get an free smartRefreshItem method for my tree? I would really need it or at least some kind of its approximation; Thx Answer posted by Support on Oct 01, 2008 05:26 The standard version of tree provides only Answer posted on Oct 02, 2008 01:12 I have a data model which I represent in a tree by generating xml outputs on the server and by sending them back to the browser over http; The model of the tree being completely decoupled from the view (the js dhtmlxtree), I need to be able to seamlessly push new changes back into the tree whenever my actions refresh the model. I could of course use the simpleRefresh() method but the problem is that is collapses all the subbranches that were already opened and isn't very neat visually speaking (no state keeping whatsoever). This is why I would very much appreciate having a method such as smartRefreshBranch/Item (didn't really get which one of them responds better to my needs) so that the root node gets cleanly updated (stick the new and remove the old nodes into the tree without no clumsy flicking on the screen) once the model has been adapted. I tried the code above with the tree.setXMLAutoLoading(url) URL as parameter but it doesn't seem to work; If you guys could just provide me with the right method code to do my job, I would be very greatfull and my chiefs would have a real argument acquiring a fully flegded library of your app; Thanks Answer posted on Oct 02, 2008 01:14 I get an undefined object error when using your code; Answer posted by Support on Oct 02, 2008 01:52 Please check attached sample Attachments (1)
Answer posted by Support on Oct 02, 2008 01:56 >>stick the new and remove the old nodes into the tree without no clumsy flicking on the screen The solution provided above is able to update and add new items, it still not able to delete not existing items, this can be done only with pro version of tree. Answer posted on Oct 03, 2008 00:11 Thank you very much guys; Even without the delete, this smart refresh is a killer :-) Although it looks like it is having some troubles refreshing branches programmatically. Answer posted by Support on Oct 03, 2008 02:02 >>Although it looks like it is having some troubles refreshing branches programmatically. The above solution is kind of hack, so it may fail in complex scenarious. You can try to add the next line of code, it must resolve problem with branch updating tree.smartRefreshItem=function(itemId,source){ if (source && source.exists) this._parse(source,itemId); } |