mardi 9 juin 2015

Reloading route after .save()

I want to reload a route after a .save(). Currently, ember-data is changing the status in the store but whatever I tried for reloading the route didn't work. The problem is I want to reload the current route based on conversation status.

For example, if I'm currently in status=opened and I close the conversation, I want to reload the route status=opened. I noticed that because the status param doesn't change, the route is not reloaded!

I tried doing a this.store.find('conversation', { status : currentStatus }), but it doesn't work.

How can I do this? I can edit for more details if needed.

I have this model hook :

model: function(params){

    return this.store.find('conversation', { status : params.status});

},

queryParams: {

    status: {
        refreshModel: true
    }
}

When I want to change the status a conversation, I'm using the following :

this.store.find('conversation', conv.id).then(function(conversation){
                conversation.set('status', 'closed');
                conversation.save();            
});




Aucun commentaire:

Enregistrer un commentaire