欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

extjs 3.31 TreeGrid實(shí)現(xiàn)靜態(tài)頁(yè)面加載json到TreeGrid里面

 更新時(shí)間:2013年04月02日 14:53:07   作者:  
extjs 3.31 TreeGrid 我的小改動(dòng),實(shí)現(xiàn)靜態(tài)頁(yè)面加載json到TreeGrid里面
想要實(shí)現(xiàn) TreeGrid的效果,打開(kāi)官方例子卻看不到效果,怎么辦呢?我是這樣實(shí)現(xiàn)的
復(fù)制代碼 代碼如下:

var root = new Ext.tree.TreeNode({
text: '根節(jié)點(diǎn)',
expanded: true
});
tree.setRootNode(root);
var nodes = {};
nodes.children = mydata;/*TreeGrid的json數(shù)據(jù)[{……},{……}]*/
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);

看源碼我們知道 TreeGrid 繼承于 TreePanel
所以 root 才是數(shù)據(jù)源而不是 store,
根據(jù)加載json數(shù)據(jù)到樹(shù)的原理,同理我們可以這樣加載json數(shù)據(jù)到 treeGrid,而不再為dataUrl: 'treegrid-data.json'這樣的加載方式而煩惱了,是不是很簡(jiǎn)單呢?

相關(guān)文章

最新評(píng)論