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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:56:28+00:00 2026-05-24T20:56:28+00:00

something strange here, i have those two portions of code in two files, base.js

  • 0

something strange here, i have those two portions of code in two files, base.js and filter.js :
//definition of generic object class

var baseObject = Backbone.Model.extend({
    copy: function(){
        _clipBoard=this;
    },
    fetch: function(){
        var obj =this;
        var criteriaString = encodeURI(JSON.stringify({_id:this.get("_id")}));
        var getUrl = _rootUrl+'/nalab/'+this.getMongoType()+'/';
        $.getJSON(getUrl + "_find", 'criteria=' + criteriaString, function(data){
            var results = data.results;
            obj.set(results[0]);
        });
    }
});

//definition of a baseObject subclass called filter with speical methods
var Filter = baseObject.extend({
    getTitleField : function(){
        return 'title';
    },
    getMongoType: function(){
        return 'filter';
    }
});

Then I do the following code in firefox 5 :

var filter = new Filter({_id:{$oid:"4e43ca017c36ec707b755659"}});
filter.fetch();
console.log(filter);
/*
Firebug shows an object with "attributes" that contains a field 'title'='Filtres avances'
*/
console.log(filter.get('title');
/*
Firebug says undefined
*/

So, why does “super” get method doesn’t work for Filter class although it works for baseObject class and never overrid it?

  • 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-24T20:56:30+00:00Added an answer on May 24, 2026 at 8:56 pm

    Because you try to get title before ajax request is finished and your data is set to model.
    If you want to get your data, try this:

    var filter = new Filter({_id:{$oid:"4e43ca017c36ec707b755659"}});
    filter.bind('change', function(model) {
        console.log(model.get('title');
    });
    filter.fetch();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm experiencing something really strange! I have a div that I'm hiding with JS
I'm studing Microsoft ASP MVC framework. Here is something strange of my page. I
Came across something strange while migrating to my new server. I have a script
I have strange problem with the delay function here using the HTML function with
I'm getting something pretty strange going on when trying to read some data using
I'm seeing something very very strange happening in a Flex app I'm maintaining. I've
I find this very strange, must be something I'm doing wrong, but still... I'm
Something I have always been interested in out of curiosity, is there a tool
Something strange happened to my servlets and I think I've figured out why, yet
I have a pretty weird situation here, and i came up with a very

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.