Results 1 to 3 of 3

Thread: Problem extending Observable...

  1. #1

    Default Problem extending Observable...

    Howdee folks,

    I'm trying to 'subclass' Ext.util.Observable' and my first step was to try to run the example code from the API docs.

    Sadly, the call to 'Employee.superclass.constructor.call(config)' fails on line 1285 of ext-all-debug.js with:-

    TypeError: Object #<an Object> has no method 'on'

    The code I lifted from the API docs is shown below:-

    Any help greatly appreciated!

    Martin

    Code:
    Employee = Ext.extend(Ext.util.Observable, {
        constructor: function(config){
            this.name = config.name;
            this.addEvents({
                "fired" : true,
                "quit" : true
            });
    
            // Copy configured listeners into *this* object so that the base class's
            // constructor will add them.
            this.listeners = config.listeners;
    
            // Call our superclass constructor to complete construction process.
            Employee.superclass.constructor.call(config)
        }
    });
    
    var newEmployee = new Employee({
        name: employeeName,
        listeners: {
            quit: function() {
                // By default, "this" will be the object that fired the event.
                alert(this.name + " has quit!");
            }
        }
    });
    Last edited by evant; 16 Feb 2010 at 2:46 AM. Reason: Please use [code][/code] tags

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Code:
    Employee.superclass.constructor.call(this, config);
    I'll add a fix to the docs.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3

    Default

    Thanks Evan!

Posting Permissions

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