jeudi 6 août 2015

Refresh plural route model when new record is saved

I have a route that looks like so:

model() {
  return this.store.query('my-model', {
    offset: this.get('offset'),
    limit: this.get('limit')
  })
}

I use this in a route like /my-models, and render a list of the models.

Then, in a route like /my-models/new, I make and save a new model. However, when I save the new model, the list of models doesn't get updated to reflect the new presence of the new model.

I think this is because store.query doesn't monitor the store, it only fetches from the server. However, when I try store.findAll, which I believe should monitor the store for changes, it returns every record, not just the ones between the offset/limit params.

Is there any way to keep the pagination working, while adding having newly created records automatically add to the list?




Aucun commentaire:

Enregistrer un commentaire