2017-09-26 2 views
1

TreePanel을 만들려고하는데 폴더 탐색기와 비슷합니다. 내 트리 패널에서 노드 확장기를 (다음 스크린 샷과 같이) 클릭하면 이벤트를 찾으려고합니다.Tree 패널 'nodeexpand'Extjs6.5의 이벤트가 작동하지 않습니다.

사람이 올바른 이벤트 무엇을 알고 있나요?

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 

      }] 
     } 
    ] 
}); 

나는 아무것도 얻을 :

여기 내보기에 대한 코드입니다. 어떻게해야합니까? 그것이 작동

답변

1

사용 itemexpand 대신 nodeexpand.

나는

Sencha Fiddle 작업 방법 여기를 점검 데모를 만들어 당신이 당신의 문제를 해결하는 데 도움이 될 것입니다 희망했다.

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`); 
     } 
    } 
}); 
+0

마지막으로 'beforeload'라는 올바른 이벤트가 있습니다. 도와 줘서 고마워, Njdhv. –

+0

대다수 ☺ –