Categories | Question details Back To List | ||||||||||||||||||||||||||||||||
[TREEGRID] Refresh branch (as tree) Dear Sir, I'm currently working on a treegrid filled at first by a provided xml. At some point, I have to update a part of this treegrid from a generated xml. It basically replace old infos of a branch by a new ones. In DHTMLXTREE, I'd have used a very useful method : smartRefreshBranch(...) or , at least, refreshItem(itemId). Unfortunatly, in DHTMLXTREEGRID, It seems that only method available for that kind of process is : updateFromXML(...) Which doesn't do the same thing (and mess with treegridline but that's a seperate matter...). Any thoughts ? Answer posted on Apr 03, 2008 09:30 >>Which doesn't do the same thing (and mess with treegridline but that's a seperate matter...). Actually it can be used to update values in treeGrid but only for single branch ( it equal to smartRefreshItem in dhtmlxtree ) - so if you will load in server side response xml for single branch - it will be correctly updated. >>at least, refreshItem(itemId). The same effect can be reached by grid.deleteChildItems(id); grid.loadXML("some.url?for="+id); Answer posted on Apr 04, 2008 05:28 >>Actually it can be used to update values in treeGrid but only for single branch ( it equal to smartRefreshItem in dhtmlxtree ) Indeed, updateFromXML is the first thing I tried out. But thing is, it doesn't exactly equal to smartRefreshItem. When you're using this method, you have two booleans params 'insert_new' and 'del_missed', like the following line : myTreeGtrid.updateFromXML(urlwhichrebuildXMLbranch , insert_new , del_missed , aftercall); In my case I need a full update, which means cells AND rows have to be updated (deleted,inserted...). So I put those params both on 'true'. Unfortunatly, when I do this, It clears all rows of treegrid except ones I'd provided in the XML. This not so surprising after all, as this method seems to have been writen in order to enhance speed over a full reload (ClearAll(), then loadXML) and ,as I'm only providing the updated branch in my XML file and 'del_missed' param is on, it does what it is asked. However, It differs from smartRefreshBranch which tries to fully update (i.e : replace a part of the tree by another) without deleting all other nodes. In the attached images, you could find a visual sample of what I'm trying to achieve without passing through a full reload. I also tried : grid.deleteChildItems(id); grid.loadXML("some.url?for="+id); But It breaks treegrid : After update done, Branch root node doesn't have anymore open/close icon. Attachments (2)
Answer posted by Support on Apr 07, 2008 05:58 Please contact us directly at support@dhtmlx.com and provide your reference number, we may send you dev. version of code which has full support of updateFromXML in TreeGrid mode. Answer posted by n.darques on Jun 03, 2008 07:16 After upgrade to 1.6 version, behaviour changed back to previous. Issue re-opened. Current code : reportGrid.updateFromXML(xmlfile,true,true,someAfterFunc); Input XML : <rows parent="user|13"> <cell image="plus_ar.gif">Darques Nicolas</cell> <cell>4.25</cell> <row id="project|13"> <cell>Projets</cell> <row id="project|13|115453"> <cell>BLOOD_RND</cell> <cell>3.75</cell> <cell>115453</cell> </row> <row id="project|13|116698"> <cell>MASCARADE</cell> <cell>0.50</cell> <cell>116698</cell> </row> </row> <row id="contract|13"> <cell>Contrats</cell> <row id="contract|day|13|1" style=""> <cell>1 : BLOOD_RND</cell> <cell>3.75</cell> <cell>115453</cell> <cell>02/06/2008</cell> <cell>03/06/2008</cell> <cell>Jour</cell> </row> <row id="contract|day|13|2" style=""> <cell>2 : MASCARADE</cell> <cell>0.5</cell> <cell>116698</cell> <cell>03/06/2008</cell> <cell>03/06/2008</cell> <cell>Jour</cell> </row> </row> </rows> See images in attachments for result. Attachments (3)
Answer posted by Support on Jun 05, 2008 09:16 Regression confirmed and fixed, updated js file sent by email. Answer posted by n.darques on Jun 06, 2008 03:21 Fixes tested. Works perfectly. Thanks. |