а

dhtmlxTree Load from list


#1

Hi,

I have a string array format as shown below. How to bind the data with dHTMLXTree? Any idea will be appreciated.
[0]: “loc1/loc2/loc3/”
[1]: “loc1/loc2/loc3//Test data.txt”
[2]: “loc1/loc2/loc3/loc4/”
[3]: “loc1/loc2/loc3/Smiley.jpg” etc…

I want the above in dHTMLXTree like loc1 as main folder and loc2 should be placed inside loc1 and loc3 should be placed inside loc2 so on.

Thanks,
Durga V.


#2

Unfortunately, it is not possible.
DHTMLX Tree and TreeGrid can load only hierarchical data.


#3

Thank you Mr.Stanislav.
I have this json which I serialized through JavaScriptSerializer. The Json seems to be valid but it does not bind with the Tree and throws an error "Error type: Data Structure, XML refers to non existing Parent ". What would be the reason ? Kindly help.

[{"id":0,"item":[{"Id":1,"text":"IvyCPG"},{"Id":2,"text":"Logs"},{"Id":3,"text":"Temp"}]},{"id":1,"item":[{"Id":1,"text":"IvyCPG"},{"Id":2,"text":"Logs"},{"Id":3,"text":"Temp"},{"Id":4,"text":"Test data.txt"}]},{"id":2,"item":[{"Id":1,"text":"IvyCPG"},{"Id":2,"text":"Logs"},{"Id":3,"text":"Temp"},{"Id":4,"text":"IvyCPG"}]},{"id":3,"item":[{"Id":1,"text":"IvyCPG"},{"Id":2,"text":"Logs"},{"Id":3,"text":"Temp"},{"Id":4,"text":"IvyCPG"},{"Id":5,"text":"TestData"}]},{"id":4,"item":[{"Id":1,"text":"IvyCPG"},{"Id":2,"text":"Logs"},{"Id":3,"text":"Temp"},{"Id":4,"text":"Test data.txt"}]},{"id":5,"item":[{"Id":1,"text":"IvyCPG"},{"Id":2,"text":"Logs"},{"Id":3,"text":"Temp"},{"Id":4,"text":"TestData"}]},{"id":6,"item":[{"Id":1,"text":"IvyCPG"},{"Id":2,"text":"Logs"},{"Id":3,"text":"Temp"},{"Id":4,"text":"ivy-dev-new"},{"Id":5,"text":"IvyCPG"},{"Id":6,"text":"Logs"},{"Id":7,"text":"Temp"},{"Id":8,"text":"TestData"}]},{"id":7,"item":[{"Id":1,"text":"IvyCPG"},{"Id":2,"text":"Logs"},{"Id":3,"text":"Temp"},{"Id":4,"text":"w-brand"}]}]

Thanks,
Durga V.


#4

Tree expects to receive data like next

snippet.dhtmlx.com/6f61baad0

  • hierarchical data
  • id instead of Id

#5

Thanks a lot Mr.Stanislav.