我正在尝试创建一个类似于文件夹资源管理器的TreePanel。当我单击树面板中的Node (如下面的屏幕快照)时,我试图找到该事件。

有人知道什么是正确的事件吗?
下面是我的观点的代码:
Ext.define('HDDTest.view.mod.searchDetails', {
extend: 'Ext.Panel',
xtype:'searchDetails',
controller: 'home',
requires: [
'HDDTest.view.mod.PreviewPlugins.PreviewPlugin',
'Ext.grid.*',
'Ext.data.*',
'Ext.util.*',
'Ext.toolbar.Paging',
'Ext.tip.QuickTipManager'
],
items: [
{
xtype: 'treepanel',
iconCls: 'icon-tree',
title: 'Tree',
collapsible: true,
height: 300,
padding:'0 20 0 0',
rootVisible: false,
id: 'treePanel',
name:'treePanel',
store: {
type: 'TreeBufferStore'
},
listeners: {
itemclick: 'onNodesSelected',
nodeexpand : 'onNodesSelected2' //<== It can not work
},
columns: [{
xtype: 'treecolumn', //this is so we know which column will show the tree
text: 'Representation',
width: 360,
sortable: true,
dataIndex: 'text',
locked: true
}, {
text: 'Parents',
width: 430,
dataIndex: 'From',
sortable: true
}, {
text: 'NCID',
width: 430,
dataIndex: 'ncid',
sortable: true
}]
}
]
});我什么也得不到。我该怎么做?
发布于 2017-09-26 05:24:11
使用项目扩展而不是节点展开,它将工作。
我已经创建了一个演示,您在这里检查它是如何工作的番泻叶。
希望它能帮助你解决问题。
var store = Ext.create('Ext.data.TreeStore', {
autoLoad: true,
autoSync: false,
root: {
expanded: true
},
proxy: {
type: 'ajax',
url: 'veddocs.json',
timeout: 300000,
reader: {
type: 'json',
root: 'children'
}
}
});
Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
width: 200,
height: 150,
store: store,
rootVisible: false,
renderTo: Ext.getBody(),
listeners: {
itemexpand: function( node, eOpts){//Fires after this Panel has expanded.
Ext.Msg.alert('Success',`Your node <b>${node.get('text')}</b> is exapand`);
}
}
});https://stackoverflow.com/questions/46417359
复制相似问题