PDA

View Full Version : How do you insert an item into a store?



profunctional
21 Oct 2010, 10:25 AM
store.Insert(0, {'TypeId': '', 'TypeName': 'Select Type'});

This doesn't seem to work.

VinylFox
21 Oct 2010, 10:30 AM
The insert method takes a Model instance as the 2nd argument, which is different from the object literal that contains the data for that record.

profunctional
22 Oct 2010, 7:26 AM
here is how i did it:


var emptySelect = Ext.ModelMgr.create({
TypeId : '',
TypeName : 'Select Type',

}, 'Type');
typeStore.insert(0, emptySelect );

mrnap
22 Oct 2010, 12:28 PM
Also, if you're just trying to insert an item (object), you can use the stores add() method.