I'm using the localstorage adapter by jeromegn https://github.com/jeromegn/Backbone.localStorage..
I am wondering if there's any way to delete an item with in local storage by a where clause, using his adapter..
Within my collection I have
localStorage: new Store("stuff")
And then within a separate view, I need something like this..
Collection.destroy({name = "Danny"});
- Which will find the row with danny and delete it..
Do I need to change his destroy function?
destroy: function(model) {
this.localStorage().removeItem(this.name+"-"+model.id);
this.records = _.reject(this.records, function(record_id){return record_id == model.id.toString();});
this.save();
return model;
}
How can I go about doing this, cheers!