Search code examples
extjsextjs4treepanel

extjs 4 show mask while check/uncheck nodes


im trying to check/uncheck specific node and its child nodes as below it is working. Except loading mask. i don't know what is the problem. why not show the mask ?

onTreepanelCheckChange: function(node, checked, eOpts) {
    tree.setLoading( 'Wait...' );
    node.cascadeBy( function( n ) {
        n.set( 'checked', checked );
        if( n.data.p_id !== 0 ) n.expand();
    } );
    tree.setLoading( false );
}

I've tried to use tree.suspendLayouts(); before cacadeBy function but result is same


Solution

  • Try changing your method to:

    onTreepanelCheckChange: function(node, checked, eOpts) {
        tree.mask('Wait...');
        Ext.defer(function(){
            node.cascadeBy( function( n ) {
                n.set( 'checked', checked );
                if( n.data.p_id !== 0 ) n.expand();
            } );
            tree.unmask();
        },100);
    }
    

    The spinner will be frozen but it will show up.