mardi 1 avril 2014

routing to page doesn't update collection in backbone


Vote count:

0




I have this set up in my router for #hello



hello: function() {
var greetingCollection = new Greetingcollection();
greetingCollection.userId = app.user.get("id");
greetingCollection.fetch({
success: function(grModel){
app.show(MyGreetingView, { model: grModel});
},
error: function(){
alert('error caused at hello route!!');
}
})
},


When i am in another route and add to the model using



this.model.save(


I redirect back to the #hello route, but the new record is not in there?


If i do a hard refresh of the whole page, the new records now appear.


My question is how can i get the collection to be up to date after the model.save or reroute to a page that shows the collection.



asked 52 secs ago






Aucun commentaire:

Enregistrer un commentaire