Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6716773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:46:25+00:00 2026-05-26T08:46:25+00:00

I have a Backbone.js collection and want to delete few elements from it at

  • 0

I have a Backbone.js collection and want to delete few elements from it at the same time. I want also remove view elements for the deleted models.

The problem is that if I use collection.remove(arrayOfModels), it fires up multiple DELETE requests. This is bad performance wise, and also I might want to cancel deletion of the whole batch if something goes wrong. So instead I want to make a single request with the list of deleted elements as a parameter.

What is the best approach here? Shall I override Backbone.sync and somehow aggregate ids of deleted elements to make a single request? Or just manually make a request and trigger ‘remove’ event for each of the deleted models to hide their views?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:46:25+00:00Added an answer on May 26, 2026 at 8:46 am

    I think the most simple & clean approach is to make you own, specific ajax request, sending to the server the id’s of the models you want to delete.

    The server returns the id’s of the models on success, and your ajax success callback can use that to remove those models from the collection. That will trigger the event for that the corresponding views listen for, so they hide themselves.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a backbone collection and when I remove a model from the collection,
I have a view and collection like this: window.DmnView = Backbone.View.extend({ template: _.template($(#tmpl_dmnListItem).html()), events:
I want to render a view when a collection has been loaded asynchronously from
My application has couple of backbone models and collection. I want to place an
I have a collection of models in my Backbone.js application. It's a list of
I have a backbone.js collection with male and female models. In my interface I
I have a backbone collection which has a bunch of models with date attributes
I have a backbone application which, upon load, needs to fetch data from four
I've got a backbone model with contains a collection. The output from the console
TL;DR Is PinView.prototype = _.extend(PinView.prototype, google.maps.OverlayView.prototype) the proper way to have a Backbone View

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.