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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:45:59+00:00 2026-06-10T15:45:59+00:00

This is not a specific code-based question. I’m looking for some intuition here with

  • 0

This is not a specific code-based question. I’m looking for some intuition here with respect to view-model binding in backbone.

Imagine I have a simple person model with properties id, First and Last name. Then I have a collection of said models returned from a JSON web service. I understand how to retrieve and update a given item via sync using backbone. Where I feel sloppy is in my binding of views and models — this is where I need a good explanation and some help on best practices.

When I create my view for a list of people, I show each person in a div with the class of the div containing TWO classnames: one named “personclass” and the other with the id of that person. Registering click event for “personclass” lets me grab the ‘other’ class – which is the id – then use that in a hash to manipulate the specific person (the underlying model of that person).

My manual view-model binding by referencing class names feels incredibly sloppy and I sense that I’m missing something fundamental about backbone. Quality of examples out there vary, so I will be grateful for a clean and easy explanation here.

  • 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-10T15:46:01+00:00Added an answer on June 10, 2026 at 3:46 pm

    There’s nothing necessarily wrong with this approach. It can be quite beneficial when you have a memory constrained environment, for example.

    Another approach, though, is to render a new Backbone.View for each item in your collection. Then each view instance can be specifically focused on the one item that it is displaying. You won’t have to worry about adding the model’s id to the rendered HTML, either.

    I wrote an article a while back that explains both of these scenarios, shows how to accomplish each, and gives pros and cons of them:

    http://lostechies.com/derickbailey/2011/10/11/backbone-js-getting-the-model-for-a-clicked-element/

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

Sidebar

Related Questions

I don't have a specific question here but I'm more looking for some guidance
Not sure if this is against stackoverflow rules as it's not a specific code
This is not a specific question but a generic question which was in my
This is not a question about a specific framework. I am using plain php
This is a general question. And may not be specific to datagrids. How can
I found some threads saying this was doable, but did not find specific instructions
(This question does not rely on a specific IoC framework, so the interfaces and
This is a very general question but it's based on a specific problem. I've
this is not a question about a specific programming problem, it's about examining different
Looking at the related questions, I don't think this specific question has been asked,

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.