0
votes

I'm trying to change ComboBox configuration by reinitializing:

Ext.onReady(function(){

   var mycb = new Ext.form.ComboBox({
       //params
   });

   //here is other component initizing
   var other = ....
      onChange: function() {
        //here I'm trying to reinitialize ComboBox
        mycb = new Ext.form.ComboBox({
           // other params
        });
   }
});

But after onChange event my ComboBox's disapeared. I tried to invoke mycb.destroy() methods, but there's the same result.

Should I unregister or something like that ComboBox? Why my component is disapearing?

3

3 Answers

1
votes

use below code ..

mycb.reset();
mycb.removeAll();
// for loading new data
mycb.loadData("new data store");
// to load attributes
mycb.load({params:{start:0, limit:25, reset:true}}); 

this is working in my code. Please change as per your need.

0
votes

Probably a better idea would be to remove the original combobox from its container and add a new one in its place. Also perhaps all you need is to reload the store with new data?

0
votes

Wrap this combo in panel with fit layout. In onChange handler remove combo from that panel, destroy it (combo), and add new combo to the panel. Having additional panel will give you easy way to put it in right place in the layout.