Code
Ext.onReady(function() {
var tree = new Ext.tree.TreePanel({
width: 250,
height: 500,
split: true,
useArrows: true,
lines: true,
minSize: 200,
maxSize: 300,
autoScroll: true,
bodyStyle: 'padding:10px',
el: "divtree",
root: new Ext.tree.AsyncTreeNode({
id: '0',
text: 'root'
}),
loader: new Ext.tree.TreeLoader({
dataUrl: 'AjaxData.ashx'
})
});
tree.on('beforeload', function(node) {
tree.loader.dataUrl = 'AjaxData.ashx?nodeid=' + node.id;
});
tree.render();
});
上面的树加载代码,只有root展开时才访问服务器数据,二级节点虽然leaf:false,也触发beforeload事件但是却根本不访问服务器,谁知道是怎么回事??