1. #1
    Sencha User
    Join Date
    Aug 2015
    Posts
    2
    Vote Rating
    0
    dnahodil is on a distinguished road

      0  

    Default Is it possible to make an Ext.data.Record class which extends Observable?

    Hi all,

    I have a class in our ExtJS 3 application which we create from Ext.data.Record because these objects will be used with a Store. We create the class like so:
    Code:
    Portal.data.DataCollection = function() {
        var constructor = Ext.data.Record.create([]);
    
        constructor.prototype.getTitle = function() {
            // ...
        };
    
        // ... add more methods the same way
    
        return constructor;
    }();
    I now want to have this class extend Ext.util.Observable so I can have instances of it fire and listen to events. However, the normal way I would so this is to create my class by using Ext.extend(superclass, overrides) and that is not applicable in this case, given how my DataCollection class is created. So my question is: is there a way to have my DataCollection class extend Observable and still be a Ext.data.Record? or, alternatively, is there a way, once I have my instances of DataCollection, to make them implement the Observable functionality?

    Any help is appreciated as I am aware how woefully out-of-date we are with our ExtJS major versions!

    Thanks,

  2. #2
    Sencha User
    Join Date
    Aug 2015
    Posts
    2
    Vote Rating
    0
    dnahodil is on a distinguished road

      0  

    Default

    If anyone is interested, I wrote a utility class which takes any JavaScript object and effectively makes it implement Observable, even if it's prototype didn't. See https://github.com/aodn/aodn-portal/...rvableUtils.js

Similar Threads

  1. Replies: 3
    Last Post: 31 Oct 2011, 7:17 AM
  2. Replies: 7
    Last Post: 15 Sep 2011, 8:33 PM

Tags for this Thread