Results 1 to 3 of 3

Thread: Call superclass function

  1. #1
    Sencha Premium Member
    Join Date
    Jan 2012

    Default Call superclass function

    mostly I'm using "this.callParent()". But what if I want to call another function than the current from the superclass? Do I have to use the ExtJS3 method with e.g. ""? Or is there another way similar to "callParent()"?
    Thanks and best regards,
    Tobias Wagener

  2. #2
    Sencha Premium User Tim Toady's Avatar
    Join Date
    Feb 2010


    As far as I know, there isn't a built in function to call the superclass's function excluding 4.0.x when callParent was added. The 4.0 to 4.1 upgrade guide recommends using the way you used in your post. I don't think it would be too difficult to roll your own, but I'm not sure it is worth the effort.

    Wow I totally misread your post. I should read things twice before responding. Yes you would have to use superclass if for some reason you didn't want to call the method on the current object. I don't know why you would override the method on the child class if you want to call the parents though. I suppose there is a use case out there.

  3. #3
    Sencha Premium Member
    Join Date
    Jan 2012


    Thanks for your reply. The reason for this is e.g. I override the setValue function of a field. In this override I start an ajax call to check the value against the server data and in the handler function I will finally call the original setValue function. Is the "this.superclass" property everytime available?

    Addinally I have created a small function "callParentFn(fn, args)" like this:

            callParentFn: function(fn, args) {
                var method,
                    superMethod = (method = this.callParentFn.caller) &&
                                  (method.$previous || (
                                           (method = method.$owner ? method : method.caller) &&
                return superMethod.apply(this, args || noArgs);
    Will this also work as expected?

    Thanks and best regards...

Tags for this Thread

Posting Permissions

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