Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Francisco on Dec 11, 2009 10:00
open dhtmlx forum
dhtmlxTreeGrid xmlkids=1 but no plus sign

Using treegrid component version 2.5.

I am loading xml from a string (using grid.parse) and my xml looks fine. I have the xmlkids=1 attribute set on my row nodes. I am expecting a "+" to appear beside each of my objects but it is only appearing on the parent object (id=1). What am I missing?

My xml is as follows:

<rows>
<row open="true" id="1" selected="1" xmlkids="1">
<cell>1<cell>
<row id="1.1" xmlkids="1">
<cell>1.1<cell>
</row>
<row id="1.2" xmlkids="1">
<cell>1.2<cell>
</row>
</row>
</rows>

Regards
Answer posted by dhxSupport on Dec 14, 2009 06:38
Your xml is not correct. 
<cell>1.1<cell> - here should be close tag
If row has xmlkids="1" attribute, should not be other <row> tags inside this row.
You can find more information here http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxtreegrid:dynamical_loading_in_treegrid
Answer posted by Alex (support) on Dec 14, 2009 06:39

Hello,

please check that you have defined kidsXmlFile property - path to the server-side script: http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxtreegrid:dynamical_loading_in_treegrid

The sample is dhtmlxTreeGrid/samples/01_initialization_loading/01_treeGrid_dynamic.html ( http://dhtmlx.com/docs/products/dhtmlxTreeGrid/samples/01_initialization_loading/01_treeGrid_dynamic.html )

Answer posted by Francisco on Dec 14, 2009 07:10

Hi,

Thanks for your response.  I am not using php.  I am trying to replace an existing tree control with your tree grid.  My existing tree control uses xml as well.  As my current application maintains an in-memory xml document (which is dynamically loaded) I was hoping to tie your treegrid control into my existing infrastructure.  I used grid.parse(xmlObject,"xmlA") where xmlObject is my existing in-memory xml document.  That worked great and I was able to render the first level of objects.  I changed my existing xml so that xmlkids attribute was present where there was child objects.  I was hoping to show the "+" sign on rows with xmlkids=1 but when the image is clicked, instead of your default handling, I wanted to use the onOpenStart event to let my current infrastructure get the child xml objects and update the in-memory xml document then have treegrid render the changes in the updated xml document (i.e. expand and show the new child rows).

Is this possible?

Regards

 

 

Answer posted by Alex (support) on Dec 15, 2009 02:34

Hello,

you can try to use the following approach

grid.attachEvent("onDynXLS",function(id){

   /*your code here*/
   return false;
})
grid.kidsXmlFile = "some.xml";

grid.loadXML("some.xml");

The example of onDynXLS event handler:

grid.attachEvent("onDynXLS",function(id){

   grid.parse("<rows parent='"+id+"'><row id='"+id+".1'><cell>Child</cell></row></rows>")
   return false;
})