Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Brendan on Jan 04, 2010 11:43
open dhtmlx forum
dhtmlx tree reload


I'm loading a tree from external URL, it works fine on first load, but when I call this a second time to load new responseObj.response, it does not refresh the tree. if I add course_list.refreshItems(0); - after the loadxmlstring then the tree is simply blanked out.

course_list = new dhtmlXTreeObject("courseboxbox_tree", "100%", "100%", 0);
course_list.setSkin('dhx_skyblue');
course_list.enableCheckBoxes(1);
course_list.setImagePath("dhtmlxTree/codebase/imgs/csh_bluebooks/");
course_list.deleteChildItems(0);
alert(nitobi.xml.serialize(responseObj.response));
course_list.loadXMLString( nitobi.xml.serialize(responseObj.response) );    

I simply want to load the new xml string into the tree.

Thanks,
Brendan
Answer posted by Stanislav (support) on Jan 05, 2010 01:31
Before loading from XML new tree, you need to clear the previous one. 

tree.deleteChildItems(0);
tree.loadXMLString( nitobi.xml.serialize(responseObj.response) );  
Answer posted by dhtmlx tree reload on Jan 05, 2010 02:54

I am doing that... and it still does not work.

course_list.deleteChildItems(0);
alert(nitobi.xml.serialize(responseObj.response));
course_list.loadXMLString( nitobi.xml.serialize(responseObj.response) );   

Answer posted by Alex (support) on Jan 05, 2010 05:41

Please check that nitobi.xml.serialize(responseObj.response) returns the desired xml structure. 

The xml format of dhtmlx components is presented here http://www.dhtmlx.com/docs/products/docsExplorer/doc/dhtmlxxml/index.html

Answer posted by Brendan on Jan 11, 2010 10:30

I have checked and the code is defintely correct... See attached for what I get when I click on a node the first time. After that any other node selected produces the xml. I know because I added a alert(xml) which shows the correct xml. See the attached. I select a node it shows the checkbox tree to the right correctly. I then select Forex and the xml is correct it does not updated the tree. I've tried all the given suggestions.

 

 

Attachments (2)
Answer posted by Alex (support) on Jan 12, 2010 06:43

The problem wasn't reproduced locally.

Could you please provide the complete demo to recreate the issue (with xml string that you try to load instead of nitobi.xml.serialize(responseObj.response))

Answer posted by Brendan on Jan 15, 2010 09:36
Even when I hard code the XML file and use loadXML it does not reload the tree.

First XML

<tree id="0">
<item text="PHP 101" id="3">
<userdata name="name">PHP 101</userdata>
<userdata name="id">3</userdata>
</item>
<item text="Coldfusion Development 101" id="7">
<userdata name="name">Coldfusion Development 101</userdata>
<userdata name="id">7</userdata>
</item>
</tree>

Second XML

<tree id="0">
<item text="PHP 101 102 103" id="3">
<userdata name="name">PHP 101</userdata>
<userdata name="id">3</userdata>
</item>
<item text="Coldfusion Development 101" id="7">
<userdata name="name">Coldfusion Development 101</userdata>
<userdata name="id">7</userdata>
</item>
</tree>


Answer posted by Brendan on Jan 15, 2010 09:43
Please check here : http://demo.inventivetec.com/inventivex/mediaresources/moodle/moodle_category_tree.cfm?contentid=10021

You will see that alert box with the correct XML.

Thanks,
Brendan
Answer posted by Alex (support) on Jan 15, 2010 09:54

Hello

there isn't a demo by this link. Please check the page. Moreover you  can send the sample to support@dhtmlx.com

Answer posted by Brendan on Jan 15, 2010 12:05
Hi Alex,

Did you recieve my email... I am desperate to get this resolve as soon as possible.

Thanks,
Brendan
Answer posted by Alex (support) on Jan 18, 2010 04:07

Hello

yes we did. The answer will be sent by email.