문제

I have a treepanel with nodes inside the treepanel. To identify whether the treepanel and not the nodes that are expanded or collapsed I use the following code:

Ext.getCmp('general').collapsed

The return value is either true or false. Is there an event in treepanel that I can capture when the treepanel is expanded or collapsed? I mean the treepanel and not the nodes in the panel.

Your help is kindly appreciated.

Thank You.

도움이 되었습니까?

해결책

You must do something wrong here, the following code works, see this JSFiddle

Ext.create('Ext.tree.Panel', {
    collapsible: true,
    title: 'Simple Tree',
    width: 200,
    height: 150,
    store: store,
    rootVisible: false,
    renderTo: Ext.getBody(),
    listeners: {
        collapse: function() {
            alert('collapsed');
        },
        expand: function() {
            alert('expand')
        }
    }
});

다른 팁

'expand' and 'collapse' don't work for me neither. Instead, 'itemcollapse', 'itemexpand', 'itemmove' and their peers do work for me. I'm with Ext-JS 4.2.1.

You used the wrong event. You need to use afteritemexpand event.

afteritemexpand: function ( node, index, item, eOpts ){
    alert('HAHA');
}

Here's a fiddle:

http://jsfiddle.net/johanhaest/RDC9W/1/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top