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

The Archive Base Latest Questions

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

This seems pretty much as a standard use of a collection, but it doesnt

  • 0

This seems pretty much as a standard use of a collection, but it doesnt work. I have the following code inside a document ready function:

$(function() {
  window.EventList = Backbone.Collection.extend({
    model: Event,
    url: '/events',
        parse: function(response) { // same result with or without parse function
      return _(response.rows).map(function(row) { return row.doc ;});
    }
  });         
  window.Events = new EventList;
  // throws Uncaught TypeError: Illegal constructor
  // Events.fetch();
});

I’ve tested with Chromium and Firefox, FF is more verbose:

this.model is not a constructor at Backbone.js line:570
[Break On This Error] model = new this.model(attrs, {collection: this}); 

What am I missing?

As a sidenote, I’m trying to follow Chris Storm’s tutorial/chain if you need a bit more context.

Relevant Software Versions:

  • jQuery JavaScript Library v1.7.1
  • Backbone.js 0.5.3
  • Underscore.js 1.2.2
  • Chromium 14.0.835.202 (Developer Build 103287 Linux) Ubuntu 11.10
  • Firefox is 8.0, Ubuntu 11.10, 64 bits

Update: a little more debugging and I find that at the point the error is thrown, this.model has the value function Event() { [native code] } and calling new Event() throws more errors – TypeError. So what’s wrong with creating events?

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

    Your problem is that you (and Chris Storm) have simply chosen a bad name for your model. There is already an Event in JavaScript (at least in a JavaScript that is wired up to a DOM); furthermore, you can’t call new Event() to create a DOM Event object, you’re supposed to use document.createEvent('Event').

    Try renaming your Event to, say, CalendarEvent:

    $(function() {
      window.CalendarEvent     = Backbone.Model.extend({});
      window.CalendarEventList = Backbone.Collection.extend({
        model: CalendarEvent,
        url: '/events',
        parse: function(response) {
          return _(response.rows).map(function(row) { return row.doc ;});
        }
      });         
      window.CalendarEvents = new CalendarEventList;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This feels like it should be pretty simple, but not much seems to be
Pretty much the same as this question. But I can't seem to get this
This seems like it should be pretty straight forward, but I'm apparently confused. I
Getting friends of friend are pretty easy, I got this which seems to work
I'm not quite understanding this fragment lifecycle business. I have a pretty standard 3
I am trying to get my head around this query - seems pretty straight
Alright I don't see why this isnt working. It seems pretty simple. Here is
I've been pretty puzzled by this one. It seems as though my implementation of
Seems I've outdone myself. All the while I was creating this pretty little 'latest
This may seem pretty basic, are you allowed to put a link inside of

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.