Bulk model.save() operations?

I've been looking through the Backbone documentation and sidecar/src, but I can't see a way this can be done.

We have a custom view with a tree/table view that combines multiple custom models and inline editing/calculation rollups.  Dirty models are tracked, and then there's a method that iterates through all the dirty models calling model.save().

Is there any way to queue these up and use the bulk api to send those .save() requests?

Parents Reply Children
  • Sure Jeff.  We're using custom modules but it's similar to Opportunities and Revenue Line Items with a few additional layers.

    Something like: Opportunities > Options > Countries > Audiences > Revenue Line Items + Service Fees.

    On the Option view, there's a table that shows all of the child models and allows for inline editing (1 model at a time), with realtime rendering of the cost/price/discount fields.  I.e. if you set a discount at the audience level, it will roll down to all RLI and Service Fee items.

    If the user changes a pricing value at the option or country level, it has to roll calculations down to all the child RLI and Service Fees.

    This requires saving all of the child models.  Since we don't limit the number of countries/audiences/etc the user can create, this can result in dozens of model.save() operations which trigger individual API requests.

    While I would love to move all of the existing business logic into a single API endpoint, it's just not feasible at this time.  What I'm hoping to do is find a way to bulk the API requests to at least reduce the overhead/round trip cost of doing 60+ model.saves().