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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:30:39+00:00 2026-05-27T11:30:39+00:00

I have a collection in backbone… in the initialize method I’m doing this…. I

  • 0

I have a collection in backbone… in the initialize method I’m doing this…. I want to rerender a view when this collection has an item added to it.

initialize: function (models, options) {

        this.bind('add', function () {
            NS.discussionView.reRender();
        });
    }

This solution works perfectly however mycoworker says I’m totally going against what backbone was designed to do. Is there a better approach to do this or is this an ok practice? The questions a bit subjective, really I want to know how I should correctly be doing something like this. Thanks for any feedback or advice.

Responding to the answer…
Well the object model is deeper. The discussionView has a discussionModel, which has a topics property which is a backbone collection of topic models. Each topic has a replies collection of reply models. When a reply is added to a topic, I need to render the discussionview again. How can I set that chain up correctly?

  • 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-27T11:30:40+00:00Added an answer on May 27, 2026 at 11:30 am

    Simply reverse the dependency: view might and should depend on model, but not the other way around. This way a single model might be used by several views (simple, detailed, etc.) and you might add views without modifying the model.

    model.bind('add', function () {
        this.render();
    });
    

    Also prefer render() method name to follow Backbone.js naming convention.

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

Sidebar

Related Questions

I have Collection List<Car> . How to compare each item from this collection with
I want to render a view when a collection has been loaded asynchronously from
So I have a collection in Backbone for a list of events. This collection
I have a backbone collection which has a bunch of models with date attributes
I have a backbone collection Platforms . The structure of Platforms looks like this:
I'm planning to have collection of items stored in a TCollection. Each item will
I have a collection of classes that I want to serialize out to an
I have a collection of Boost unit tests I want to run as a
As in the backbone-todolist example,I have a collection of elements. I made 2 views,
I have a simple comparator function on a Backbone.js collection. comparator: function (topic) {

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.