【问题标题】:Extjs 4.1 How to add a specialkey event to all fields by mvcExtjs 4.1 如何通过mvc向所有字段添加特殊键事件
【发布时间】:2013-04-30 06:48:47
【问题描述】:

如何向 from.panel 的所有字段添加特殊键事件?在此表单面板中,每个字段都使用一种方法来搜索我的商店我的商店名称“S01I009001”, 有谁能够帮助我? 为我奇怪的英语道歉。

Ext.define('${pkgName}.v01i009001.SV01I00900104' , {    
    extend              : 'Ext.form.Panel',
    alias               : 'widget.sv01i00900104',
    requires            : ['Ext.form.field.Text'],
    id                  : 'sv01i00900104',
    padding             : '0 0 0 0',  

    defaults: {        
        activeRecord    : null,
        border          : true, 
        layout          : 'hbox',        
        fieldDefaults   : {
            anchor      : '100%',
            labelAlign  : 'right'
        }
    },

    initComponent       : function(){        
        Ext.QuickTips.init();
        Ext.form.Field.prototype.msgTarget = 'qtip';         
        me          = this; 
        me.items    = [{
            xtype                 : 'fieldcontainer',
            combineErrors         :  true,                    
            defaults              : {
                layout            : 'fit',
                margin            : '3 5 1 5',
                hideLabel         :  false,                
                labelAlign        : 'top'
            },
            items: [{
                xtype             : 'numberfield',
                name              : 'id',
                fieldLabel        : 'REBATE ID:',
                width             :  100,                        
                minValue          :  0,
                mouseWheelEnabled :  false,
                hideTrigger       :  true,
                decimalPrecision  :  0,
                keyNavEnabled     :  false                       
            },{
                xtype             : 'datefield',
                name              : 'endDate',
                fieldLabel        : 'End Date:',
                flex              :  1,
                format            : 'M d, Y',
                altFormats        : 'd/m/Y|M d, Y h:i A',
                id                : 'enddt-sv01i00900104',
                vtype             : 'daterange',
                startDateField    : 'startdt-sv01i00900104'                                          
            }]
        }];       
        me.callParent(arguments);
    }
});

【问题讨论】:

    标签: extjs4.1


    【解决方案1】:

    我认为这是您的解决方案。如果我是对的

     init: function() {
    
                this.control({'sv01i00900104 *' : {
                        specialkey: function (field, el) {
                            if (el.getKey() == Ext.EventObject.ENTER || el.getKey()==el.TAB){
                                this.filter()
                            }
                        }
                    }   
        }); 
      },    
    
    filter:function(){    
        var form        = Ext.getCmp('sv01i00900104').getForm(),
        idValue         = form.findField('id').getValue(),
        endDate         = form.findField('endDate').getValue(),
        filters         = new Array();                     
        if(idValue){
            filters.push({property:'id', value:idValue});
        }                    
        if(endDate){
            filters.push({property:'endDate', value:endDate});
        }  
        var  store  = Ext.data.StoreManager.lookup(storeName);
         store.clearFilter();
         store.loadPage(1, {
          filters  : array                                
        });
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多