Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/457.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Extjs-树面板展开事件_Javascript_Extjs_Treepanel - Fatal编程技术网

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');
}