I am using fetch in the index action of the following backbone.js controller:
App.Controllers.PlanMembers = Backbone.Controller.extend({
routes: {
"": "index"
},
index: function () {
var planMembers = new App.Collections.PlanMembers();
planMembers.fetch({
success: function () {
var recoveryTeam = planMembers.select(function (planMember) {
return planMember.get("TeamMemberRole") == "RecoveryTeam";
});
var otherMembers = planMembers.select(function (planMember) {
return planMember.get("TeamMemberRole") == "Other";
});
new App.Views.Index({ collection: { name: "Team", members: recoveryTeam }, el: $('#recoveryTeam') });
new App.Views.Index({ collection: { name: "Team", members: otherMembers }, el: $('#otherTeam') });
},
error: function () {
alert('failure');
showErrorMessage("Error loading planMembers.");
}
});
}
});
The problem is that the results are being cached. It does not pick up database changes. Is there anyway to tell backbone.js not to cache the results?
I know I could override the url of the collection and append a timestamp but I am looking for something a bit cleaner than that.
question from:
https://stackoverflow.com/questions/6178366/backbone-js-fetch-results-cached 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…