Reputation: 3333
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
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
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