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

  • Home
  • SEARCH
  • 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 7949395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:59:12+00:00 2026-06-04T01:59:12+00:00

I have a Backbone collection model (with sub-models as elements) and views to edit

  • 0

I have a Backbone collection model (with sub-models as elements)
and views to edit it.

I would like it that when the model is initially created, to “turn off”
sync, so the back end is never invoked until the user clicks on a
button, then I would like to “turn on” the sync, and invoke the save
method on the root model, in order to save it to the DB.
Once a model it saved, it should behave like a normal model.

The goal is to avoid saving until the user determines that he is happy with
what he has entered.

  • 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-06-04T01:59:13+00:00Added an answer on June 4, 2026 at 1:59 am

    Backbone will initially look for a model’s local sync function before going to Backbone.sync.

    Backbone.js Documentation: The sync function may be overriden globally as Backbone.sync, or at a finer-grained level, by adding a sync function to a Backbone collection or to an individual model.

    Therefore you can do this:

    var MyModel = Backbone.Model.extend({
        // New instances of this model will have a 'dud' sync function
        sync: function () { return false; }
    });
    
    var MyView = Backbone.View.extend({
    
       ...
    
       events : {
           'click #my-button' : 'enableSync',
           'click #my-save-button' : 'saveModel'
       },
    
       enableSync: function () {
           // If this view's model is still pointing to our fake sync function,
           // update it so that it references Backbone.sync going forward.
           if (this.model.sync !== Backbone.sync) {
              this.model.sync = Backbone.sync;
           }
       },
    
       saveModel: function () {
           // This won't actually do anything until we click '#my-button'
           this.model.save();
       }
    
       ...
    
    });
    
    var view = new MyView({ model: new MyModel() });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Backbone View that has a Collection as its Model. If the
I've got a Backbone.Collection full of models; let's say that model is Car .
I have a Backbone.js Collection and I have an array of model IDs that
I have a super simple Backbone model/collection that wraps around a facebook feed. window.Story
I have Backbone.js collection that holds (for example) 30 items. I want to pass
I have a collection of flash cards that are tied to a Backbone collection.
I have two backbone models, loaded from server: var Model = Backbone.Model.extend({}); var SubModel
I have the following Backbone.js model and collection: // Model lr.Event = Backbone.Model.extend({}); //
I have a backbone view that calls to a sub-view: lr.MapView = Backbone.View.extend({ el:
I have very simple backbone model and collection. I have a corresponding backbone.marionette.CollectionView and

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.