简体   繁体   中英

SetValue to a variable in a form Extjs

I have this code in my form:

var code = I want to assign the codigoEmpresa value !!

{
                        xtype: 'textfield',                                                       
                        name: 'codigoEmpresa',
                        itemId: 'codigoEmpresa',
                        hidden: true,
                        hideable: false,
                    }, 
                    {
                        xtype: 'combobox',
                        x: 120,
                        y: 5,
                        width: 250,
                        fieldLabel: 'Empresa',
                        name: 'empresa',
                        labelWidth: 60,
                        itemId: 'comboEmpresa',
                        emptyText: 'Seleccione Empresa',
                        displayField: 'nombre',
                        valueField: 'id',
                        store: new Ext.create('SgaWeb.store.comunes.Empresas'),
                        queryMode:'local',
                        editable: false,                    
                    },
                    {
                        xtype: 'textfield',                                                       
                        name: 'codigoDepartamento',
                        itemId: 'codigoDepartamento',
                        hidden: true,
                        hideable: false,
                    },                        
                    {
                        xtype: 'combobox',
                        x: 390,
                        y: 5,
                        width: 280,
                        fieldLabel: 'Departamento',
                        labelWidth: 90,
                        name: 'departamento',
                        itemId: 'comboDepto',
                        queryMode: 'local',
                        emptyText: 'Seleccione Departamento',
                        displayField: 'nombre',
                        valueField: 'id',
                        store: new Ext.create('SgaWeb.store.comunes.Departamentos'),
                        editable: false,                    
                    },

I need to assign the value of codigoEmpresa to a variable. How can I do this in the same form ?. I need to use that variable for others purposes in this form but I don´t know how to get the value of codigoEmpresa and set it to a variable

var codigoEmpresaValue = this.getForm().findField('codigoEmpresa').getValue(); 

表单的范围需要调整(this,this.down(),this.up())

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM