I have this record I have created whose model only exists locally (not in the api). The model is as follows:
TM.Vdpmodel=DS.Model.extend({
type:DS.attr(),
description:DS.attr(),
vds:DS.attr(),
});
I use this model to create an array of objects (vdps) in the JSON. See below.
{"vdps":[{"type":"ssdfdfg","description":"fhfgh","vds":[{"type":"fghgh","example":"jghhgj"},{"type":"gjghj","example":"ghjghj"},{"type":"ghjghj","example":"ghjghj"}]}],"asset_usage":[]}
I create them using
TM.obj.vdp.pushObject(this.store.createRecord('vdpmodel',{
type:this.get("vdp11"),
description:this.get("vdp12"),
vds:TM.vdobj.vd.objectsAt([this.get("vdcount"),this.get("vdcount")+1,this.get("vdcount")+2])
}));
This record is only stored locally. Now I want to delete a record from this store which has a whose type value is "abc". How do I do this? Keeping in mind, the record only exists locally at the moment.
I've tried the following:
var records=this.store.filter('vdpmodel',function(data){
return data.get('type')==="abc";
});
records.forEach(function(record){
record.deleteRecord();
});
But records is never populated. Any idea what I am doing wrong here?
Aucun commentaire:
Enregistrer un commentaire