从网格中的控制器调用函数

时间:2018-03-03 23:34:02

标签: javascript function extjs controller

我有这段代码:

{
                xtype: 'gridcolumn',
                dataIndex: 'parentesco',
                itemId: 'parentesco',
                flex: 1,
                text: 'Parentesco',
                editor: {
                        xtype: 'combobox',                            
                        name: 'parientes',
                        valueField: 'codigo',
                        displayField: 'descripcion',
                        store: Ext.create('SgaWeb.store.administrativo.rrhh.dominio.Parentesco', {autoLoad:false}),
                        allowBlank : false,
                        editable: false,
                        //readOnly: true,
                        itemId: 'parientes', 
                        listeners: {
                        beforeselect: function()
                        {
                            var me = this;
                            SgaWeb.app.getController('SgaWeb.controller.administrativo.rrhh.GestionRecursosHumanos').grid();
                            //var gridGrupoFamiliar = me.ventanaGestionRrhh.down('#pestanasVarias').down('#pestanaGrupoFamiliar');
                            var fila = grid.getSelectionModel().getSelection()[0];
                            var codigo = fila.get('codigo'); 
                            alert(+codigo);
                        },
                        select: function(combo){                          

                            var id = combo.getValue();
                            var record = combo.getStore().getById(id);
                            record = combo.findRecord(combo.valueField || combo.displayField, id);                                                              

                            me.down('#parentesco').getEditor().setValue(record.get('codigo'));

                            var fila = me.getSelectionModel().getSelection()[0];
                            fila.set('parentesco',record.get('codigo'));      

                        },                     
                    }                  
                }         
            },

在beforeselect:function中,我试图在组合框选择之前调用控制器中的函数。

有没有办法做到这一点?

0 个答案:

没有答案