I am converting my base application so that it starts communicating with the server, earlier I just filled the collection with test data using .add()
I associated some events with the event of adding collections. Therefore, every time an item is added to the collection, I can visualize the view and update some statistics.
it seems that as soon as I add a call .fetch()to receive data from the server, the add events will stop.
eg
var PayableCommitmentCollection = Backbone.Collection.extend({
model:PayableCommitment,
url:"/cc/account/contributions/",
initialize: function() {
this.bind("add",this.setInitialAmount,this);
}
}
this.SetInitialAmount() never called after fetch creates models in the collection.
I also have 2 views that view items that will be added to this collection that are no longer being updated.
- AJAX, , , , , .
- , , .