Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mathijs on Jul 16, 2008 10:48
open dhtmlx forum
ParentID in item

why does this not work? I mean: defining parentid in item definition.
This is very common situation when getting data from database.

<tree id="0">
<item id="CC7A9FC0-FC3F-9683-A8BFA68A66A71B3C" parentid="0" text="Directie"/>
<item id="CC7AE044-C70A-BB18-3B5DF07438207905" parentid="CC7A9FC0-FC3F-9683-A8BFA68A66A71B3C" text="Financiele Administratie"/>
<item id="CC7B9BA4-D517-0E24-43089F2A6EF2B3FE" parentid="CC7A9FC0-FC3F-9683-A8BFA68A66A71B3C" text="Inkoop"/>
<item id="CC7B2888-BC40-15CA-D860A7B4444EC6FE" parentid="CC7A9FC0-FC3F-9683-A8BFA68A66A71B3C" text="Kwaliteitszorg"/>
<item id="69E92265-F79C-EBD8-FB4F7009046CA9A2" parentid="CC7A9FC0-FC3F-9683-A8BFA68A66A71B3C" text="Marketing"/>
<item id="CC7DAC35-B8AF-0012-71497D967946856A" parentid="CC7A9FC0-FC3F-9683-A8BFA68A66A71B3C" text="Personeel & Organisatie"/>
<item id="CC7C6398-E110-5406-9A4F8EFB710FD836" parentid="CC7A9FC0-FC3F-9683-A8BFA68A66A71B3C" text="Productontwikkeling"/>
<item id="CC7C1190-0A25-F14C-15A99574B76377D2" parentid="CC7A9FC0-FC3F-9683-A8BFA68A66A71B3C" text="Service"/>
<item id="CC7BD36E-9D57-9EF5-60995422A7FDEF55" parentid="CC7A9FC0-FC3F-9683-A8BFA68A66A71B3C" text="Verkoop"/>
<item id="4F80457F-D24B-33CF-C163633B7376753D" parentid="CC7BD36E-9D57-9EF5-60995422A7FDEF55" text="Binnendienst"/>
</tree>
Answer posted by Support on Jul 17, 2008 05:33
In case of loading data in XML format, component awaits, that parent child relation will be defined by XML structure.
But it possible to achieve similar functionality with different data loading types, when data loaded from CSV of JSArray it possible to encode it in such way
    http://dhtmlx.com/docs/products/dhtmlxTree/samples/json_support/pro_load_csv.html?un=1216299132000
    http://dhtmlx.com/docs/products/dhtmlxTree/samples/json_support/pro_load_jsarray.html?un=1216299143000
In both cases structure of tree defined by provided parent id