Reputation: 1911
I have store that contains all of the images that the user has uploaded over time. When they upload a new group of images I receive each image's ID from the uploader. They are then moved to a new route where they need to update those newly uploaded images with meta data. I would like to use the previous store but filter out everything except the images they have uploaded.
So the question is... How do I filter a store by only a range of ids. For example, if my uploader returns [30, 31, 32]. I would like the view to only display those images.
I think the router should have a filter property like this but I'm not sure.
App.PhotosDetailsRoute = Ember.Route.extend( {
model: function(params) {
return this.get('content').filterBy('id', id >= params[0] );
}
});
Any help would be appreciated.
Upvotes: 1
Views: 643
Reputation: 47367
You'll want to use the filter function, I'm not positive what content is in this case, but this is how you use filter
model: function(params) {
this.store.find('photos');
return this.store.filter('photos', function(item){
return item.get('id') >= 10; // dummy parameter
});
}
Upvotes: 2