Raje
Raje

Reputation: 3333

Add/Remove Extjs combo value

I am newbie to extjs.I need to add/remove some values from extjs combo box base on some condition. I tried following code but no luck.

var obj =Ext.getCmp('filter');
                    var myArray=new Array();
                    myArray['id'] = 'a';
                    myArray['value'] = 'a';
                    var rec = new Ext.data.Record(myArray);
                    //obj.store.add(rec);

                    obj.store.removed(rec);
                    }

Upvotes: 0

Views: 3669

Answers (2)

Selmaril
Selmaril

Reputation: 766

Use getById to find record for remove.

var combo = Ext.getCmp('filter');
combo.store.remove(combo.store.getById('a')); //typo: sotre corrected to store

combo.store.remove(combo.store.getById('a'));

Upvotes: 3

LellisMoon
LellisMoon

Reputation: 5020

obj.store.remove(rec);

removed is not a store function.

removed is a buffer array in which all removed recors are added.

if you're going to have a big store, you should keep this array empty, because removed objects are stored during all the session.

if the combo didn't change try to add store.sync() after adding or removing records

Upvotes: 0

Related Questions