“How” to save an entire collection in Backbone.js - Backbone.sync or jQuery.ajax?

前端 未结 11 1285
醉梦人生
醉梦人生 2020-11-28 19:45

I am well aware it can be done and I\'ve looked at quite a few places (including: Best practice for saving an entire collection?). But I\'m still not clear \"exactly how\"

11条回答
  •  旧巷少年郎
    2020-11-28 20:24

    For anyone who is still using backbone.js in 2017, the accepted answer is not working.

    Try removing the toJSON() override in the wrapper model and calling toJSON on the collection when you instantiate the model wrapper.

    new ModelWrapper(Collection.toJSON());
    

提交回复
热议问题