Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/02/2016, 14:42
luisquintanar5
 
Fecha de Ingreso: enero-2016
Mensajes: 7
Antigüedad: 8 años, 3 meses
Puntos: 0
Exclamación Usar el valor de un radioGroup para realizar una consulta que se cargue en un comboBo

Tengo una pantalla que tiene un radioGroup el cual sólo tiene dos opciones, y dependiendo cuál esté seleccionada, se realiza una consulta cuyos valores regresados se cargan en un comboBox. El problema es que el valor del radioGroup no puedo pasarlo al Store que usa el comboBox, les muestro el código que se utiliza.

Esto se usa con Extjs. Éste es el código del Store:

Código:
var cuentaStore = Ext.create('Ext.data.Store', {
    model : 'catCuentaModel',
    proxy : {
        type : 'ajax',
        url : '../action/cuentas',
        method : 'GET',
        pageParam: false,
        startParam: false,
        limitParam: false,
        noCache: false,
        reader : {
            type : 'json',
            root : 'claveCuenta'
        },
        extraParams : { 
            'tCta' : ''
       }

    }
});
Éste es el código del Form:

Código:
MyForm = Ext.create('Ext.form.Panel', {
    title: 'Reporte de Cuentas',
    margin:'5 0 0 300',
    renderTo: 'repcueayb',
    url: urlReporte,
    bodyStyle: 'padding:5px 5px 0',
    //layout: 'vbox',
    frame: true,
    width: 600, //600
    height: 230,
    //layout: 'border',
    standardSubmit: true,
    items: [Txt_FechaIni, Txt_FechaFin,                
      {
        xtype: 'radiogroup',
        id: 'tipoCta',
        fieldLabel: 'Tipo de cuenta',
        width: 300,
        items: [
           {boxLabel: 'A', name: 'tCta', inputValue: 0, checked: true},
           {boxLabel: 'B',   name: 'tCta', inputValue: 1}
        ],
        listeners: {
            scope: this,
            'checked': function() {
                cuentaStore.getProxy().extraParams = {
                    tCta: Ext.getCmp('tipoCta')
                };

                cuentaStore.load({
                    params : {

                        tCta: Ext.getCmp('tipoCta')
                    }
                });
            }
        }
      },
      {
          id : 'cuenta',
          name : 'cuenta',
          xtype : 'combobox',
          fieldLabel : 'Cuenta',
          emptyText : '-Seleccionar-',
          store : cuentaStore,
          displayField : 'cuenta',
          valueField : 'cuenta',
          editable : false,
          forceSelection : true,
          triggerAction : 'all',
          allowBlank : false,
          blankText : 'Debe seleccionar unna cuenta.'
      } ,
      {
        xtype: 'radiogroup',
        id: 'formato',
        fieldLabel: 'Formato',
        items: [
          {boxLabel: 'Excel', name: 'fmtoval', inputValue: 1, checked: true},
          {boxLabel: 'PDF',   name: 'fmtoval', inputValue: 2},
          {boxLabel: 'CSV',   name: 'fmtoval', inputValue: 3}
        ]
      }],
    buttons: [btn, btn2]
});

Pero al momento de dar clic al comboBox no me regresa nada ya que no le paso en ningun momento el parametro tCta.