2017-09-26 5 views
1

私はTreePanelを作成しようとしていますが、これはフォルダエクスプローラのようなものです。ツリーパネルでNode Expander(次のスクリーンショット)をクリックすると、イベントを見つけることを試みています。ツリーパネルExtjs6.5の 'nodeexpand'イベントが機能しない

誰が正しいイベント何を知っていますか?

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

大歓迎☺ –

関連する問題