extjs3 获取formPanel下的所有控件

_setReadOnly: function(_readOnly) {
        _readOnly = this.readOnly||_readOnly;
        var types = ['field'];
        for(var i=0; i<types.length; i++){
            fields = this.findByType(types[i]);
            Ext.each(fields,function(item,index,allItems){
                item.setDisabled(_readOnly);
            });
        }
        Ext.each(Test.util.findButtons(this),function(item){
            item.setDisabled(_readOnly);
        });
    }

 

//获取所有按钮
define(function(require, exports, module){ Ext.ns("Test.util"); Test.util.findButtons = function(c, s){ var array = []; if( c.toolbars ){ Ext.each(c.toolbars, function(i){ var a = i.items.items; Ext.each(a,function(i){ if( i.xtype=='button' || i.type=='button'){ array.push(i); } }); }); } if( c.items && c.items.items ){ var i = c.items.items; Ext.each(i,function(i){ if(i.xtype=='button' || i.type=='button'){ array.push(i); } else if(s !== true) { array = array.concat(IRMS.util.findButtons(i)); } }); } return array; }; exports = Test.util; });

 

posted @ 2016-06-03 16:27  探讨  阅读(1482)  评论(0编辑  收藏  举报