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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:41:32+00:00 2026-06-12T09:41:32+00:00

The initial fetch done for a collection retrieves partial details for each model. When

  • 0

The initial fetch done for a collection retrieves partial details for each model. When the user clicks on an item on the webpage, it will need to retrieve more details for that item and display it to the user.

The API function to return the additional data missing in the initial fetch for that item has already been implemented (/api/full_details).

Problem: How should I retrieve the additional and append it to the existing model? My understanding is that if I do a model.fetch(), the existing data in that model will be gone. I think that if the fetch() for models have an option {add:true} like the fetch() for collections, that’ll be what I need here.

Model

Listing = Backbone.Model.extend({
});

Collection

ListingCollection = Backbone.Collection.extend({
    model: Listing,
    url: '/api/search'
});

View

ListingListView = Backbone.View.extend({ ........ });

ListingView = Backbone.View.extend({
    events: {
        'click': 'getFullDetails'
    },

    getFullDetails: function() {
        // What should I do here?
    }
})

Somewhere in the router

this.listingList = new ListingCollection();
var self = this;
this.listingList.fetch({
    data: {some:data},
    processData: true,
    success: function() {   
        self.listingListView = new ListingListView({ collection: self.listingListNew });
        self.listingListView.render();
    }
  • 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-12T09:41:33+00:00Added an answer on June 12, 2026 at 9:41 am

    I’d probably use two separate models for this:

    1. Your existing model would become ListingSummary and your collection would contain ListingSummary instances.
    2. Create a new Listing (or ListingFull) model for the full versions. This would be backed by /api/full_details.

    You could initialize full models using the information you already have in the your summary models:

    var ListingSummary = Backbone.Model.extend({
        //...
        getListing: function() {
            if(!this._full) {
                this._full = new Listing({ summary: this });
                this._full.fetch();
            }
            return this._full;
        }
    });
    

    and then over in the full version:

    var Listing = Backbone.Model.extend({
        initialize: function() {
            if(this.options.summary) {
                // Copy the interesting bits from this.options.summary.attributes
                // to this.attributes, possibly using this.set()
            }
        }
    });
    

    Then your full listing view could check if its Listing is fully loaded: if it is then the view could display the full listing but if the model isn’t all there yet, the view could show what is there and throw up a spinner/loader/throbber/whatever-you-call-it while waiting for the server to respond with the full Listing model; your view would, as usual, listing for events from the model to know when everything was ready.

    You could do the same thing your existing Listing model, you’d just fire off a raw $.ajax call instead of using a separate model:

    loadFullModel: function() {
        if(this._fullyLoaded)
            return;
        // Call out to /api/full_details ...
        var _this = this;
        $.ajax({
            //...
            success: function(data) {
                // Do things with data...
                _this._fully_loaded = true;
                // Trigger your event...
            }
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to fetch a collection by giving an initial model parameter
My user will select an initial year, I want mysql to select the value
One of my backbone view's initialize function contains the following code: $.when(this.broadcasters.fetch(), this.model.fetch(), this.call_types.fetch()).done(
When a fetch is called (in response to a user's action) after an initial
My initial task was to find a segmenter for Windows that will split a
I have an UITableView populated by a NSFetchedResultsController . The initial fetch works fine.
I am using the load() function to fetch details dynamically from different pages by
Sorry this is a noob question but if I only need some initial data
I have the following Query and i need the query to fetch data from
I am developing an iphone app which will fetch the data from CSV file

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.