Home > Web Front-end > JS Tutorial > extjs 3.31 TreeGrid implements static page loading json into TreeGrid_extjs

extjs 3.31 TreeGrid implements static page loading json into TreeGrid_extjs

WBOY
Release: 2016-05-16 17:38:28
Original
936 people have browsed it

I want to achieve the effect of TreeGrid, but I can’t see the effect when I open the official example. What should I do? This is how I implemented it

Copy code The code is 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);

Looking at the source code, we know that TreeGrid inherits from TreePanel
So root is the data source instead of store.
According to the principle of loading json data into the tree, similarly we can load json data like this Go to treeGrid and no longer worry about loading methods like dataUrl: 'treegrid-data.json'. Isn't it very simple?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template