Extjs4 tabpanel, disable all child item without looping them

4.9k Views Asked by At

is there are any way to disable all child items on Extjs4 tab panel, without looping them.

my code:

var myPanel = new Ext.TabPanel({
    region: 'east',
    title: 'my panel title',
    width: 200,
    id: 'my-panel',
    split: true,
    collapsible: true,
    collapsed: true,
    floatable: true,
    xtype: 'tabpanel',
    items: [
        Ext.create('Ext.panel.Panel', {
        id: 'my-detail-panel',
        title: 'My Info',
        autoScroll: true,
        file: false,
        type: 'vbox',
        align: 'stretch',
        tpl: myDetailsTpl
    }),
        Ext.create('Ext.panel.Panel', {
        id: 'my-more-detail-panel',
        title: 'My more info',
        autoScroll: true,
        file: false,
        type: 'vbox',
        align: 'stretch',
        tpl: myMoreDetailsTpl
    })
            ]
});

i need disable myPanel's all child items, but still need to 'myPanel' keep status as enable .

3

There are 3 best solutions below

2
egerardus On BEST ANSWER
myPanel.items.each(function(c){c.disable();})

then

myPanel.items.each(function(c){c.enable();})

to fire them back up again.

This is looping, but it is not using a "for loop" as I think the question was meant to state.

1
dbrin On

You can just set disabled:true on the initial config for each panel. Is that what you were asking?

0
Magnus Reuter On

Try his:

// Create your own property for storing statu, 

config{
  allMyTabItemsEnabled = true;
}

// Then on all the items you want to disable/enable, add:

bind: {
  disabled: '{!allMyTabItemsEnabled }'
}