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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:51:18+00:00 2026-05-31T09:51:18+00:00

I’m upgrading from backbone.js 0.5.3 to 0.9.1 and I’m having issues with one particular

  • 0

I’m upgrading from backbone.js 0.5.3 to 0.9.1 and I’m having issues with one particular error here is the back trace:

**Uncaught TypeError: object is not a function**
_.extend._prepareModel
_.extend.add
_.extend.reset
Backbone.Collection
child
Backbone.View.extend.render
(anonymous function)
Backbone.Events.trigger
stage.$el.stop.animate.complete
jQuery.extend.speed.opt.complete
jQuery.fx.step
t
jQuery.extend.tick

when I go to the code and study it, it seems to be coming from a collection but the final error point is:

// Prepare a model or hash of attributes to be added to this collection.
    _prepareModel: function(model, options) {
      options || (options = {});
      if (!(model instanceof Model)) {
        var attrs = model;
        options.collection = this;
        model = new this.model(attrs, options);
       /
      /
     /
   here:    Uncaught TypeError: object is not a function



        if (!model._validate(model.attributes, options)) model = false;
      } else if (!model.collection) {
        model.collection = this;
      }
      return model;
    },

Update:

As requested here are the steps:

//from inside the collection (this object is actually coming in from elsewhere but 
var viewconfig ={
            id:"values-tab-panel",
            idprefix:"values-tab",
            classname:"tabpanel",
            items:[
                {
                    urlRoot:"/"+lang+"/values",
                    url:"someurl1"

                },
                {
                    urlRoot:"/"+lang+"/values",
                    url:"/someurl2"

                },
                {
                    urlRoot:"/"+lang+"/values",
                    url:"/someurl3",
                }
            ]}
    this.view   = new TabPanelView(viewconfig); 

then inside of the view:

render: function(args){
        // 
        /*
         * what needs to happen is that the first time the render is called it creates a jquery DOM object which
         * can then be manipulated hencforth, currently there's all kinds of javscript bits which relate to it but not
         * an actual piece of DOM. closure should deal with the rest of it but theres nothing which is assigned
         * 
         */
        if(!args)
        {
            //first render
            var nav             = $("<aside/>").addClass("tab-navigation").append("<ol/>").attr("role","navigation");
            var tabcontent      = $("<section/>").addClass("tab-panels");
            for(i = 0;i<this.views.length;i++)
            {
                $("ol",nav).append("<li><a rel='"+this.views[i].id+"' href='javascript:;' class='tab-nav'></a></li>");
                tabcontent.append(this.views[i].el);
            }
            this.$el.empty().append(nav).append(tabcontent);
            //this.$el.append("<aside class='tab-navigation' ><ol role='navigation'>"+listhtm+"</ol></aside>")
            //this.$el.append("<section class='tab-panels'>"+innerhtm+"</section>");

            this.attach();
        }
        else if(args && args.update == true){
            // partial render -- i.e. update happening

            this.container = $(this.id);
            var targetid = args.what.cid;
            for(i = 0;i<this.views.length;i++)
            {
                var curcontent  = this.$el.find("div#"+this.views[i].id);
                var curlink     = this.$el.find("a[rel='"+this.views[i].id+"']")
                if(this.views[i].cid == targetid)
                {
                    curcontent.html($(this.views[i].el).html());
                    curlink.text(this.views[i].model.rawdata.header);
                }
                if(i>0)
                {
                    // set the first panel 
                    curcontent.addClass("tab-content-hide");
                }
                if(i==0)
                {
                    curcontent.addClass("tab-content-show");
                    curlink.addClass("tab-nav-selected");
                }
                //$("a[rel='"+this.views[i].id+"']").die().unbind().live("mousedown",this.switchtabs);// dont ask 
                log("a[rel='"+this.views[i].id+"']")
            }

            this.update();
        }
        return this;
    },
  • 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-31T09:51:19+00:00Added an answer on May 31, 2026 at 9:51 am

    I’m still not completely sure if this is right ut it’s removed my error and making things progress well now.

    It seems as though Backbone 0.9.x has made it so that you cannot set a model in your Collection’s initialize function. For me the error was that in backbone 0.5.x i could do this:

    var mycollection = Backbone.Collection.extend({
        initialize: function(args)
        {
            this.model = new mycollectionmodel();
                    //some stuff
            }
    });
    var whatever = new mycollection();
    

    however in backbone 0.9.x i have to do this:

    var mycollection = Backbone.Collection.extend({
            model: mycollectionmodel,
        initialize: function(args)
        {
            //some stuff
            }
    });
    var whatever = new mycollection();
    

    or this:

    var mycollection = Backbone.Collection.extend({
        initialize: function(args)
        {
            //some stuff
            }
    });
    var whatever = new mycollection({model:new mycollectionmodel()});
    

    but the first throws the error above…

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string

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.