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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:22:04+00:00 2026-05-27T09:22:04+00:00

Frustratingly, most ‘tutorial’ examples of backbone.js apps assume a clean model slate. I-.e. that

  • 0

Frustratingly, most ‘tutorial’ examples of backbone.js apps assume a clean model slate. I-.e. that the model collections are empty initially, until a user adds an item. Of course this is not the case in a real world app, where you usually have an existing collection to start with from the back end store.

I would like to know how people deal with existing collections in backbone. Specifically:

  • How do you render a collection after it has been fetched? Is is just a case of iterating through the collection? Should this be trigger by some event?

  • The backbone docs talk about ‘bootstrapping’, which I understand means using data that is available on the initial load (this also makes sense from an SEO point of view). But how does this work in practice? The data is dumped into JS on the server side? Or the JS examines the DOM?

I feel like this is a poor question, but I expect to expand it based on the answers.

EDIT

So it seems that the consensus is to add the data as party of the JS and process that on page load.

One big disadvantage I see with this technique is that the information is not available for search engine spiders. From that perspective it might be better to extract it from the DOM (although I haven’t seen anyone do it that way). Or maybe add the HTML server side and stick the data in the JS?

  • 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-27T09:22:05+00:00Added an answer on May 27, 2026 at 9:22 am

    I came across the same situation as you, I don’t always want my data bootstrapped initially (especially if its from a third-party api call). I haven’t come across any tutorials that do this but looking through the documentation its actually pretty easy. You just need to bind the ‘reset’ event (this is fired when the entire collection is repopulated) on your collection and render. Heres a quick example:

    my_application.js

    window.MyApplication = {
      Models: {},
      Collections: {},
      Views: {},
      Routers: {},
      init: function() {
        // Start the data loading
        this.someItems = new MyApplication.Collections.Items();
        this.someItems.fetch();
    
        // Start rendering the UI before the data is ready
        new MyApplication.Routers.Items(this.someItems);
        Backbone.history.start();
      }
    };
    

    routers/items_router.js

    MyApplication.Routers.Items = Backbone.Router.extend({
      routes: {
        "" : "index"
      },
    
      initialize: function(collection) {
        this.collection = collection;
      },
    
      index: function() {
        var view = new MyApplication.Views.ItemsIndex({ collection: this.collection });
        $('.items').html(view.render().el);
      }
    });
    

    views/items/items_index.js

    MyApplication.Views.ItemsIndex = Backbone.View.extend({
      initialize: function() {
        _.bindAll(this, "render");
    
        // Once the collection is fetched re-render the view
        this.collection.bind("reset", this.render);
      },
    
      render: function() {
        console.log(this.collection.length);
        // Render content
        return this;
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found out that I am doing WPF wrong and frustratingly must overhaul
I find that one of the most frustrating aspects to software development is finding
This has got to be one of the most frustratingly stupid bugs I have
One frustrating behavior in vim is that when i move my cursor right or
Well this is incredibly frustrating. After being nagged by Rails that I need to
I have a really frustrating error that I've spent hours looking at and cannot
This has got to be one of the most frustrating issues with asp.net. I
Oh, the frustration! I have literally had the most frustrating morning ever. I've spent
I am making a project in C# that's basically an image screen scraper for
Where do you have the most success getting your ArcGIS development questions answered? ESRI

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.