dimanche 23 avril 2017

How to update an ember-infinity infinityModel?

I am trying to implement searching with ember-infinity. But, I do not understand the interaction between the route model and infinityModel.

I have the following code:

model() {
  ...
  return this.infinityModel("myModel", {...}, {...})
}

My search action looks like the following:

search(searchCriteria){
  const _this = this;
  ...
  _this.infinityModel("myModel", {search:searchCriteria, ...}, {...}).then((myMod)=>{
    ...
    _this.controller.set('model', myModel);
  }); 
}

So this works, but the my query gets fired twice when search is called.

The following only fires the query once.

search(searchCriteria){
  const _this = this;
  ...
  _this.infinityModel("myModel", {search:searchCriteria, ...}, {...}); 
}

But my model does not update. However infinityModelUpdated() function is fired. So I assume that means the infiniteModel was updated, which I assume is my model.

I am pretty sure I am missing something simple. But any help would be greatly appreciated.




Aucun commentaire:

Enregistrer un commentaire