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 7021977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:31:13+00:00 2026-05-27T23:31:13+00:00

According to Backbone.js documentation: Whenever a UI action causes an attribute of a model

  • 0

According to Backbone.js documentation:

Whenever a UI action causes an attribute of a model to change, the
model triggers a “change” event; all the Views that display the
model’s data are notified of the event, causing them to re-render.

So I suppose that render() method should be bound to “change” event by default. However the following code does not work:

TestModel = Backbone.Model.extend({});
TestView  = Backbone.View.extend({
    render: function() {
        alert('render called');
    }
});
var mod  = new TestModel;
var view = new TestView({model:mod});
mod.change();

It works only if I add explicit bind call:

initialize: function() {
    this.model.bind('change', this.render, this);
}

Does this mean that my understanding of default render() callback is not correct and we should always bind render() callback by hand?

  • 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-27T23:31:14+00:00Added an answer on May 27, 2026 at 11:31 pm

    Unless something has changed in the last few months, yes, that is the case. This is a good thing, as it gives flexibility as to when views are rendered/re-rendered (for example, some applications might want to render a view only after a model has been persisted on the server, not necessarily when it changes in the browser). If you want your views to always re-render when a model attribute changes, you can extend the default backbone view with your own base view that binds its render method to the model change event, then extend all your concrete views from that. Ex:

    MyView = Backbone.View.extend({
        initialize: function() {
            Backbone.View.prototype.initialize.apply(this, arguments);
            this.model.bind('change', this.render);
        }
    });
    
    MyConcreteView = MyView.extend({...});
    var model = new Backbone.Model({...});
    var view = new MyConcreteView({model: model});
    model.set({prop: 'value'});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to the PHP Documentation PDO::prepare() adds quotes to all your parameters so that
According to the official documentation , the KeyDown event on a Windows Forms control
According to this discussion , the iphone agreement says that it doesn't allow loading
According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to
According to Wikipedia, on the Comparison of programming languages page, it says that F#
According to the feedparser documentation , I can turn an RSS feed into a
According to what I've heard, integer values that are not the processor's word size
According to the documentation , socket_read() is supposed to return FALSE when the remote
According to be Spring Framework documentation, logging is the only mandatory dependency of Spring.
According to MDN documentation for JSON.stringify : Properties of non-array objects are not guaranteed

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.