Results 1 to 2 of 2

Thread: Uncaught TypeError: Object [object Object] has no method 'getName'

  1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    22
    Vote Rating
    0
      0  

    Default Uncaught TypeError: Object [object Object] has no method 'getName'

    Uncaught TypeError: Object [object Object] has no method 'getName'

    i am getting this error when i try to run the code below
    can someone please enlighten me on this...

    Code:
    Ext.application({
    	launch: function(){
    var pk=Ext.define('Animal', {
        cofig: {
            name: null
        },
    
    
        constructor: function(cofig) {
            this.initConfig(cofig);
        },
    
    
        speak: function() {
            alert('grunt');
        }
    });
    //var bob = Ext.create('Animal', {
    //    name: 'Bob'
    //});
    
    
    //bob.speak(); //alerts 'grunt'
    Ext.define('Human', {
        extend: 'Animal',
    
    
        speak: function() {
            alert(this.getName());
        }
    });
    
    
    var bob = Ext.create('Human', {
        name: 'Bob'
    });
    
    
    bob.speak(); //alerts 'Bob'
    }
    });
    thanks in advance..
    Last edited by mitchellsimoens; 4 Mar 2012 at 6:28 AM. Reason: added [CODE] tags

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Answers
    3976
    Vote Rating
    1381
      0  

    Default

    This

    Code:
    var pk=Ext.define('Animal', {
        cofig: {
            name: null
        },
    
    
        constructor: function(cofig) {
            this.initConfig(cofig);
        },
    
    
        speak: function() {
            alert('grunt');
        }
    });
    should be (cofig should be config):

    Code:
    var pk=Ext.define('Animal', {
        config: {
            name: null
        },
    
    
        constructor: function(config) {
            this.initConfig(config);
        },
    
    
        speak: function() {
            alert('grunt');
        }
    });
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •