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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:03:02+00:00 2026-05-30T15:03:02+00:00

i am fetching data using following code _.each(cardIds, function(id){ var mdc = new MdlCard({cardId:

  • 0

i am fetching data using following code

 _.each(cardIds, function(id){        
                   var mdc = new MdlCard({cardId: parseInt(id)});                                
                  mdc.fetch({data:{cardId: parseInt(id)}});
                   cards.reset(mdc); 
               });

cardIds contains cardId for particular list. in my cardview

initialize: function(){           
           _.bindAll(this,'render');
           this.model.bind('change', this.render, this);
           this.model.bind('destroy', this.remove, this);
       },
       render: function() {              
           var res = {data: this.model.toJSON(),ccId: this.model.cid};           $(this.el).html(this.template(res));                                                      

           chkIds = this.model.get('checklists');
           return this;
       },

i am passing this card model to template. but it will fetch two object per one request
first object contains default value which i am defining while creating card model and second from the db(which actually i want)

but when i am writing this line chkIds = this.model.get('checklists'); it will return nothing. pls help me to find problem in this code.

  • 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-30T15:03:04+00:00Added an answer on May 30, 2026 at 3:03 pm

    in short, fetch is asynchronous. So when you create the model at first, it hasn’t fetched all the values from the server yet. Once they’re done fetching, it will re-render your view with the updated values. My guess is that you’re rendering the view after you create it. You might instead wait for the model change event to fire (after the fetch is done) and it will render once the fetch is complete.

    Another suggestions based on what you posted (not to do necessarily with the problem you’re seeing): You don’t have to set the data attribute when calling fetch. The default implementation of Backbone.sync will do that for you so mdc.fetch({data:{cardId: parseInt(id)}}); should be mdc.fetch();

    Hopefully that’s helpful–if so pls mark as answered as @tkone suggested

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

Sidebar

Related Questions

I'm fetching some data from FB using the following code: dynamic parameters = new
I am using following zend code to select all data from a table where
I'm using the following code for fetching a latest tweet but I would like
I am fetching data using following query : select * from tbl_words where userID
EDIT: trying to excute the following code in Winforms. I am fetching the data
I have an App using UITableViews and fetching data from a server. I am
I'm fetching some data from an MSSQL table using the mssql_fetch_object, but the text
I'm using core data and fetching the results successfully. I've few questions regarding core
I am using the following Code to execute the SP of MySql and get
i am using ADO.Net oledb for inserting and fetching data from Excel database. I

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.