Gustavo
Gustavo

Reputation: 795

Remove from a ComboBox a parameter in extjs 3.4

I want to remove a parameter from the store of a comboBox before it shows to the user, I know more or less how to do it but it´s not working properly, any one could give some solution? Maybe I need to select an specific event, but I tried with all the events that make sense and didn´t work, Here is the code:

 var combo = fwk.ctrl.form.ComboBox({
    storeConfig: {
        url: app.bo.type.type_find
        ,fields: ['id', 'code']

    }
     ,comboBoxConfig:{
        triggerAction: 'all'
        ,allowBlank:false
    }
});

 combo.on('beforeshow', function() {
    combo.store.removeAt(2); 
   });

Thank you very much!!!

Upvotes: 1

Views: 305

Answers (2)

Gustavo
Gustavo

Reputation: 795

Here you have the solution,

      combo.getStore().load({
           callback: function (r, options, success) {
              if (success) {
                combo.store.removeAt(2);
         }
           }
     });    

Is necessary to change it before the load of the store because first is painted the combobox and then is charged with the store data I was erasing data in a empty store.

Upvotes: 0

newmount
newmount

Reputation: 1951

Try removing it inside 'afterRender' event,

sample code:

listeners: {
        'afterrender': function(comboRef) {
            comboRef.store.removeAt(2);
        }
    }

Upvotes: 1

Related Questions