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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:24:18+00:00 2026-06-04T06:24:18+00:00

My question most likely requires a very simple answer, which, nevertheless, I was not

  • 0

My question most likely requires a very simple answer, which, nevertheless, I was not able to easily find.

A Backbone application I am working on has several views. When defining the different views, I use _.bindAll in the initialize function to connect the “this” view object with the view’s render function. For example:

DiscussedItemView = Backbone.View.extend({
    ...
        initialize: function() {
            _.bindAll(this, "render");
        },


        render: function() {    

            this.$el.attr('id', 'li-meeting-task-' + this.model.getId());

            this.$el.html(JST['tasks_sandbox/agenda_task_item']({ 
                taskName    : this.model.getName(),
                taskId      : this.model.getId()
            }));

            return this;
        },
    ...
});

To create a new instance of the DiscussedItemView, I do the following:

...
        var discussion_agenda_row = new DiscussedItemView({model: task});
        discussion_agenda_row.render();
        this.$( '#meeting-items-list' ).append(discussion_agenda_row.$el); 
...

The code works fine. Still, I do not understand why there is a need for the explicit use of the render() function on discussion_agenda_row. I thought that the initialization of a new DiscussedItemView instance would automatically call the render function, but if I remove the discussion_agenda_row.render(); row, the HTML will not be displayed. Where am I mistaken?

Thank you,
Alexandra

  • 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-04T06:24:20+00:00Added an answer on June 4, 2026 at 6:24 am

    Views respond to changes in the model. In your code, you’re not making a change to the model, so the view is not responding. You also haven’t set the view as a listener to model changes. What you could do in your initialize is something like this:

    initialize : function() {
        //this will tell the view to render when the model 
        //triggers a "change" event
        this.model.on("change", this.render, this);
    
        //this will make the model throw the change event
        //and since the view is listening to "change," render will be invoked.
        this.model.fetch();
    }
    

    All that said, if you’re not doing any fetching and the data is just there in your model, you’ll still have to explicitly call view.render(). In any case, for good MVC, I’d still make the view listen to changes in the model so it will properly update itself in response.

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

Sidebar

Related Questions

This is a very simple question, and most likely requires a very simple answer.
I have what is most likely a very simple question.. I am designing a
I know this is most-likely a simple question but when you restore a database
I've got a question that most likely doesn't have a unique and clear answer.
Apologies, my question may be incorrect, but CLIENT_LOCALE seems like the current most-likely culprit:
I need to extract data from HTML-files. The files in question are, most likely,
One more question about most elegant and simple implementation of element combinations in F#.
This not a programming question but Most of the programmers using Eclipse should have
I most likely have the same problem as in this question: Weird Chrome prototype/jQuery
This is most likely a ridiculous question, but I'm intrigued by the thought so

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.