mercredi 19 juillet 2017

How to reload the model when using this.get('store').query?

I have a user model with attributes name and city, i am fetching 25 records at a time from server since there are lot of user records

so my routes has this

model(){
return this.get('store').query('user', {page:1}); }

which fetches me the first 25 records

Now in my template i have a button which on click hits the action to fetch the next 25 records ie

action:{
findMoreUsers(){
        this.get('store').query('user', {page:2});
    } }

Now in the browser, in the ember data the new records are loaded ie it shows 50 records

but when i try to do something like this.get('model'), it gives me the only the old records but not the newly loaded records

So how to to refersh the model so that it shows me all the old as well as new records(50 records)?

Thanks




Aucun commentaire:

Enregistrer un commentaire