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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:40:25+00:00 2026-06-06T01:40:25+00:00

On page load I’m bootstrapping my data to my collections via this technique .

  • 0

On page load I’m bootstrapping my data to my collections via this technique. That works great, but I’m running into an issue where I have sub-models which also need to be cast.

For example, I return a JSON collection called Book, and each book array contains 10-20 models themselves called Pages. If I try and access Pages directly, I get the [object][object] error as Backbone can’t figure out what type of object it is.

Previously when I was using fetch, I would get around this by using collections which contained a parse action. In parse I would do something like:

Collection_Books = Backbone.Collection.extend({
    model: Model_Book,
    parse: function (response) {
        response.Pages = new Collection_Pages(response.Pages);
        return response;
    }
});

Now that I’m accessing the data directly and not using fetch, the documentation implies that I no longer have access to the parse method.

If I am not using fetch or calling a server on page load, how can I cast sub-models using the Books > Pages example?

  • 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-06T01:40:28+00:00Added an answer on June 6, 2026 at 1:40 am

    Update: This answer is now out of date, see uglymunky’s answer for more up to date information.


    You’re right, parse is only specified to be called during fetch so it won’t be called when you’re building a collection from raw data.

    But, since you control the raw data that you’re using to bootstrap your collection, you can call your collection’s parse yourself:

    var c = new YourCollection(
        YourCollection.prototype.parse([
            // attribute data goes here...
        ])
    );
    

    Demo: http://jsfiddle.net/ambiguous/kdaZ3/

    Your parse methods (both collection and model) shouldn’t care about their calling context so calling them directly from the prototype should be fine.

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

Sidebar

Related Questions

var Page = { data: null, Load: function () { this.Populate; }, Populate: function
I understand that the page load of asp.net (mvc 2.0ish) sites can suffer for
During page load, index 0 was already selected. Then this code statement selected index
Our initial page load is a beast in our Rails app. The great thing
On page load i am adding this code if (Request.Cookies[switchstyle] != null) { string
On page load, I'm loading an html page through jquery ajax. This html page
During an ASP.NET page load I'm opening and closing multiple System.Data.SqlClient.SqlConnections inside multiple controls
I want this div to load instantly on page load (or thereabouts) and then
This script always gets executed on page load. My problem is with JavaScript. It
My question is that how to maintained page load time in c# and what

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.