Javascript Extjs-树面板展开事件
我想创建一个树面板,并在展开节点时向其中添加一个事件,但代码似乎不适合我。我已经在谷歌上搜索了好几个小时了,但是运气不好。谁能看一下并告诉我为什么 这是我的:Javascript Extjs-树面板展开事件,javascript,extjs,treepanel,Javascript,Extjs,Treepanel,我想创建一个树面板,并在展开节点时向其中添加一个事件,但代码似乎不适合我。我已经在谷歌上搜索了好几个小时了,但是运气不好。谁能看一下并告诉我为什么 这是我的: 提前谢谢 您使用了错误的事件。您需要使用事件 这是一把小提琴: 您使用了错误的事件。您需要使用事件 这是一把小提琴: Awww nevermind,我的坏,这应该添加到存储侦听器,而不是面板Awww nevermind,我的坏,这应该添加到存储侦听器,而不是面板 Ext.onReady(function () { var stor
提前谢谢 您使用了错误的事件。您需要使用事件 这是一把小提琴:
您使用了错误的事件。您需要使用事件 这是一把小提琴:
Awww nevermind,我的坏,这应该添加到存储侦听器,而不是面板Awww nevermind,我的坏,这应该添加到存储侦听器,而不是面板
Ext.onReady(function () {
var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [{
text: "detention",
leaf: true
}, {
text: "homework",
expanded: false,
children: [{
text: "book report",
leaf: true
}, {
text: "alegrbra",
leaf: true
}]
}, {
text: "buy lottery tickets",
leaf: true
}]
}
});
Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
width: 200,
height: 150,
store: store,
rootVisible: false,
renderTo: Ext.getBody(),
listeners: {
afteritemexpand: function ( node, index, item, eOpts ){
alert('HAHA');
}
}
});
});
afteritemexpand: function ( node, index, item, eOpts ){
alert('HAHA');
}