Hi,
Can someone please share the small json template which is required for dhtmlx to create a tree.
Thanks!
Hi
Here is a little sample:
tree.loadJSONObject({
id:'0', item:[
{id: '0-1', text: 'Item 1-0', tooltip: "Item 1-0", item:[
{id: '0-1-0', text: 'Item 1-0-0', tooltip: "Item 1-0-0"},
{id: '0-2-0', text: 'Item 2-0-0', tooltip: "Item 2-0-0"},
{id: '0-3-0', text: 'Item 3-0-0', tooltip: "Item 3-0-0"}
]},
{id: '0-2', text: 'Item 2-0', tooltip: "Item 2-0"},
{id: '0-3', text: 'Item 3-0', tooltip: "Item 3-0"}
]});
But you can find some other samples in dhtmlxTree sample folder from downloaded suit
Thanks alot Darya!
In my case I am going to build the json in my spring controller.So can I write this piece of code in some file and refer that filename inside loadJSONObject()method .
Or can you advise how the runtime created JSON can be passed to this method loadJSONObject()?
Yes, you can use json file, i.e. (source code of myjson.json file)
{id:'0', item:[
{id: '0-1', text: 'Item 1-0', child: '1'},
{id: '0-2', text: 'Item 2-0', child: '1'},
{id: '0-3', text: 'Item 3-0', child: '1'}
]}
And call loadJSON method:
tree.loadJSON("myjson.json");
Thanks Darya ! But I will bother you and this forum with some more basis queries on dhtmlx,as I am starting from zero in this area.
You are welcome!
You can also read carefully documentation of dhtmlxTree here:
docs.dhtmlx.com/tree__index.html
And look through tree-related samples:
dhtmlx.com/docs/products/dhtmlxT … index.html