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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:17:11+00:00 2026-05-27T20:17:11+00:00

I apologize for being new with backbone but I think I get the concepts.

  • 0

I apologize for being new with backbone but I think I get the concepts.

For example: you have models for a Bookstore > Bookshelf > Book > Page

How would you organize this so the views can be controlled like this:

Bookstore.render() //to view the bookstore
Bookstore.bookshelf.get(shelfId).render() //to view shelf
Bookstore.bookshelf.get(shelfId).book.get(bookId).render() //to view book
Bookstore.bookshelf.get(shelfId).books.get(bookId).pages.at(0).render() //to view page

Is this the correct way to do it?

  • 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-27T20:17:12+00:00Added an answer on May 27, 2026 at 8:17 pm

    Yes It’s possible and I created for you a working example, I think It’s just an other method to organize your Backbone JS architecture and I think It’s a pretty good idea.

    Explications

    All the models must have :

    • a render method which call the render method of its view. I create a base model that I extend for the Bookshelf, Book and Page model.

    • a initialize method, It create the collection (books for bookshelves, pages for book…)

    Finally I instanced the Bookstore model and It’s done !

    Code

    The demonstration : http://jsfiddle.net/Atinux/DvbA3/show/

    Try in the console :

    Bookstore.render()
    Bookstore.bookshelves.get(1).render()
    Bookstore.bookshelves.get(1).books.get(2).render()
    Bookstore.bookshelves.get(1).books.get(2).pages.at(0).render()
    

    The code with comments is available here : http://jsfiddle.net/Atinux/DvbA3/

    I think the best thing is to understand how the code work. Feel free to ask me if you have problems to understand perfectly my code.

    The JSON data

    The JSON data have to look like :

    var data = {
        bookshelves: [{
            id: 1,
            name: 'Science',
            books: [{
                id: 1,
                name: 'Abstract Algebra',
                pages: [
                    { content: 'Page 1 Abstract'},
                    { content: 'Page 2 Abstract'},
                    { content: 'Page 3 Abstract'}
                ]
                }, {
                        id: 2,
                        name: 'Chemistry and Technology of Fertilizers',
                        pages: [
                    { content: 'Chemistry page 1' },
                    { content: 'Chemistry page 2' },
                    { content: 'Chemistry page 3' }
                ]
              }
            ]
          }, {
            id: 2,
            name: 'Psychology',
            books: [{
                id: 1,
                name: 'How to Think Straight About Psychology',
                pages: [
                    { content: 'Psychology page 1' },
                    { content: 'Psychology page 2' },
                ]
              }
            ]
          }
        ]
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new here and I've searched for questions to help me but I have
I apologize for the subjectiveness of this question, but I am a little stuck
I apologize in advance for being too vague, if you need any precision I
Programming is so new to me that I apologize for not knowing how to
I currently have a site with multiple articles being user-generated as content. On each
I apologize for being a bit verbose in advance: if you want to skip
I'm new to programming and apologize up front if I misuse terminology. In a
I'd like to apologize if my question doesn't sound very much specific, but i
I apologize if this question has been asked before, but my case is a
Please keep in mind that I'm new to C# and OOP so I apologize

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.