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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:32:23+00:00 2026-05-22T17:32:23+00:00

Here is my content.js in which i am using backbone.js for rendering contents. //

  • 0

Here is my content.js in which i am using backbone.js for rendering contents.

 // Our basic **Content** model has `content`, `order`, and `done` attributes.
var Content = Backbone.Model.extend({
  // If you don't provide a Content, one will be provided for you.
  EMPTY: "empty Content...",
  // Ensure that each Content created has `content`.
  initialize: function() {

  }
});
var ContentCollection = Backbone.Collection.extend({  
  model : Content
});     
// Create our global collection of **Todos**.
window.Contents = new ContentCollection;
// The DOM element for a Content item...
var ContentView = Backbone.View.extend({
  //... is a list tag.
  tagName:  "li",
  events: {
    "click .content":          "open"
  },
  // a one-to-one correspondence between a **Content** and a **ContentView** in this
  // app, we set a direct reference on the model for convenience.
  initialize: function() {
    _.bindAll(this, 'render', 'close');
    this.model.bind('change', this.render);
    this.model.view = this;
  },
  // Re-render the contents of the Content item.
  render: function() {
    $(this.el).html(this.template(this.model.toJSON()));
    return this;
  }

});

Here is how i am making the list of content and rendering them.

 for(var i=0; i<data.length; i++) {
      var content = new Content(data[i]);
      var templ=_.template($('#tmpl_content').html());

      var view = new ContentView({model: content});
      view.template=templ;
      $("#content").append(view.render().el);
 }

my question is how can i get the contetnt model listing .
as i have created the collection

 var ContentCollection = Backbone.Collection.extend({  
      model : Content
    });     
    // Create our global collection of **Todos**.
    window.Contents = new ContentCollection;

So when i do watch Contents it shows length 0 and models [] .

how contetnt will get added in the collection . or how to see list of model in backbone.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-22T17:32:24+00:00Added an answer on May 22, 2026 at 5:32 pm

    You need to Collection.add(models) before it will contain anything.

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

Sidebar

Related Questions

Here's the problem: I have couple of pages which gets its content from a
Who here is using WASP ( http://wasp.sourceforge.net/content/ ) to in real world applications? What
I am using cluetip which works great but the content of one of my
I'm loading in content using an iframe via a menu with jquery which is
I have some content which in the database has linebreaks stored and when I
I have a situation here: I have a page which is using to show
I'm using Jquery plugin ZClip or ZeroClipboard which copies content to the clipboard via
I want to be able to have default text like Enter content here... appear
I have some content sliding here. http://www.smallsharptools.com/downloads/jQuery/Slider/slider.html The HTML structure is simple. There is
Here is my try: @header(Content-type: text/html; charset=utf-8); @header(Location:/index.php); @header(Cache-Control: no-cache, must-revalidate); // HTTP/1.1 @header(Expires:

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.