Closed nikmartin closed 10 years ago
I think your problem might be resolved with recent changes on master. Can you try the latest?
I will, I had pulled trackit out when it didn't seem to be tracking changes for me, but I'll out it back in and give it a try.
I must be doing something TOTALLY wrong. I'm using this with stickit, and call this.stickit()
at the end of the render function as usual, and if I change several model attributes, then hit my save function,
console.log(view.model.unsavedAttributes());
returns false.
I'm also using marionette if that matters, along with backbone.deep-model.
Backbone.Model.prototype.set = _.wrap(Backbone.Model.prototype.set, function(oldSet, key, val, options) {
this is not firing when used with stickit and deep-model. When I type into an html field, this doesnt work.
Ok, I got it to work in the WORST way possible:
at https://github.com/NYTimes/backbone.trackit/blob/master/backbone.trackit.js#L146
I did:
Backbone.DeepModel.prototype.set = _.wrap(Backbone.Model.prototype.set || Backbone.DeepModel.prototype.set, function(oldSet, key, val, options) {
I don't know another way to handle loading a plugin like backbone.trackit, when another library has already monkeypatched Backbone.Model, like Backbone.DeepModel
I am using Backbone, Marionette, stickit, and just installed trackit to give me PATCH support on model.save. When my view loads, I do:
and if I set a breakpoint inside startTracking, It gets hit at the proper time properly. Just before calling model.save, I do:
but changes is always false, and a full copy of my model is sent with the save.
I set a break point in the Backbone.Model.prototype.set wrapper, and it never gets hit.
Could this be due to a conflict with stickit? Marionette? For some reason my model is getting updated just fine by stickit, but the set function in trackit is never called, leading me to believe something else is overloading Model.set.