I have created an API that pulls in data using the seek method. Similar to a instagram style feed. So I provide a id,limit and it returns what I need. But I could not find anyone that has implemented the seek method in their pagination. I settled on a combination of 2 things query route and controller/component action:
Page.Route
queryParams: {
id: {
refreshModel: false
}
},
model: function(params) {
var prop = this;
return this.store.findQuery('product', params);
},
Page.Component
actions: {
updateQuery: function(){
var control = this;
var prop = this.get('model');
control.set('id', prop.meta['id']);
var params = { id:this.get('id')};
this.store.find('product', params).then(function(product) {
prop.addObjects(product);
});
},
I’m wondering if there is a more accepted implementation of the seek method. My version is not bulletproof still have issues transitioning between routes. ex. ?id=104&limit=50 will load all the 50 records after 104 but I lose the 50 records before 104. Although ember data maintains all of these records after they have loaded So its a interesting problem