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

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

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

var root = new Ext.tree.TreeNode({
text: '根節(jié)點',
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ù)到樹的原理,同理我們可以這樣加載json數(shù)據(jù)到 treeGrid,而不再為dataUrl: 'treegrid-data.json'這樣的加載方式而煩惱了,是不是很簡單呢?

相關(guān)文章

最新評論