Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Francisco on Dec 17, 2009 06:20
open dhtmlx forum
TreeGrid and custom xml

Hello,

Does the treegrid support loading of custom xml structures as described in
http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Custom_loading_types.html#grid_art_custloadtypes

or is that just for the grid?

If I am using "xmlA" when loading my xml into the treegrid, how do I specify custom images?

Thanks for your great support thus far.

Regards,
Francisco

Answer posted by Alex (support) on Dec 17, 2009 09:20

Hello,

treegrid supports "xmlA" loading format.

But  unfortunately this format allows to specify only cell values and therefore  it isn't possible to define cell images in this case.

Answer posted by Francisco on Dec 17, 2009 12:26

 

Ok.  So, does the treegrid support loading of custom xml structures (other than xmlA or xmlB)?  I was not sure from your previous answer.

 

 

 

Answer posted by Alex (support) on Dec 18, 2009 03:06

Hello,

there are only deault, xmlA and xmlB xml structures. Also it possible to redefine rows and row tag names:

mygrid.xml.top = "data"
mygrid.xml.row = "myrow";
mygrid.load("some.xml");

Creating custom loading types is possible for treegrid, but it is rather complcated. Please, see information about that:

http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxgrid:data_loading#custom_loading_types_creation

Please see dhtmlxgrid_data.js as an example (code of xmlA and xmlB types creation).



Answer posted by Francisco on Dec 18, 2009 05:34

Thank you.  xmlB is very close to what I need.  The only issue is the cell level parser.  xmlB expects the cells to be children of the row.  In my case, their is a node between the row and the cells  i.e.:

<row><metadata><cell/></metadata></row>

I am assuming that I have no choice but to create a custom loading type to support the above xml structure.  Are there any other caveats with custom loading types?

 

Regards.

Answer posted by Alex (support) on Dec 18, 2009 06:04

You can try to use default xml loading, but xml.row property should be redefined:

mygrid.xml.row = "row/metadata";
mygrid.load("some.xml");


Answer posted by Francisco on Dec 18, 2009 06:30

Sorry, xml in previous post was incorrect.  Here is the corrected version:

 

Actually I tried that already but could not get it to work...My xml is as follows:

<object id="0">

<metadata>

<objname/>

<startdate/>

</metadata>

<childlist>

<object id="1.1">

<metadata>

<objname/>

<startdate/>

</metadata>

<childlist/>

</object>

<object id="1.2">

<metadata>

<objname/>

<startdate/>

</metadata>

<childlist>

<object id="1.2.1">

<metadata>

<objname/>

<startdate/>

</metadata>

<childlist/>

</object>

<object id="1.2.2">

<metadata>

<objname/>

<startdate/>

</metadata>

<childlist/>

</object>

</childlist>

</object>

</childlist>

</object>

 

So, in my case

mygrid.xml.top = "object";

mygrid.xml.row = "childlist/object";

but the cell date is in "childlist/object/metadata/objname";

 

I could not get that structure to work using either the default loader or xmlB.

Answer posted by Francisco on Dec 18, 2009 06:34

Also,

If I am forced into a custom loader type do you have an easier to read version of how xmlB is defined?  dhtmlxgrid_data.js is difficult to read.

Thank you for your excellent support thus far.

 

Answer posted by Alex (support) on Dec 18, 2009 06:50

Unfortunately there isn't ready solution to customize <cell> tag.

Uncompressed libraries can be found in the sources folder: dhtmlxGrid/sources/ext/dhtmlxgrid_data.js