PDA

View Full Version : How do you set a record in store



ci11111
28 Mar 2012, 1:14 AM
Ext.Array.each(store.getNewRecords(), function(item, index) {
console.log(item.get('publisherID')+" "+index);
// item.set('publisherID', 'something') ?????.
});

dedoz
28 Mar 2012, 2:02 AM
be careful using getNewRecords if your model has validations. getNewRecords currently return only valid new record (that satisfy the valitadion rules defined in the model)

if you want to set publisherId to every new record better do something like


store.each(function(record) {
if (record.phantom) record.set('publisherID', somevalue);
});