Want to achieve the effect of Treegrid, open official examples but see no effect, how to do? That's how I realized it.
Copy Code code as follows:
var root = new Ext.tree.TreeNode ({
Text: ' Root node ',
Expanded:true
});
Tree.setrootnode (root);
var nodes = {};
Nodes.children = Mydata;/*treegrid's JSON data [{... ...},{...}] */
function appendchild (node, o) {
if (O.children!= null && o.children.length > 0) {
for (var a = 0; a < o.children.length; a++) {
var n = new Ext.tree.TreeNode ({
Task:o.children[a].task,
Duration:o.children[a].duration,
User:o.children[a].user,
Iconcls:o.children[a].iconcls
});
Node.appendchild (n);
AppendChild (n, O.children[a]);
}
}
}
AppendChild (root, nodes);
Look at the source we know Treegrid inherited from Treepanel
So root is the data source, not the store,
Based on the principle of loading JSON data to a tree, we can do this by loading JSON data into Treegrid instead of worrying about Dataurl: ' Treegrid-data.json ' loading mode, is it simple?