Results 1 to 3 of 3

Thread: callSuper, callParent, arguments and [arguments]

  1. #1
    Sencha User
    Join Date
    Apr 2010
    Posts
    40
    Vote Rating
    1
      0  

    Default Answered: callSuper, callParent, arguments and [arguments]

    Hi,
    just to clarify this once and for all...is there any difference between those variants?

    this.callParent(); vs this.callSuper();

    and

    this.callParent(arguments) vs this.callParent([arguments]);

    and

    calling one of both (or are there more?) in constructor or method calls (e.g. initialize).

    When looking at the code, there seems none and if it is an alias, one method should call the other, right?

    And at last, could you please provide a complete documentation in the FAQ (https://docs.sencha.com/extjs/6.5.3/...ould_i_use_it_) and / or in the guides as the net is full of proposals for this problem.

    Thanks!

  2. callSuper is meant to be used in overrides where you can call the class you are overriding’s superclass method. Basically a way to skip the class you are overwriting’s method.

    callParent is where you can call the superclass’ method (or in an override the original method you are overriding).

    Giving any array or arguments is the same as using call or apply. You shouldn’t give arguments wrapped in an array. If you know the args you want to pass then use an array with individual arguments: [arg1, arg2].

    I have a couple blogs that may interest you:
    https://mitchellsimoens.com/2015/01/...ent-callsuper/
    https://mitchellsimoens.com/2015/01/...ethods-safely/

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,307
    Answers
    3992
    Vote Rating
    1477
      0  

    Default

    callSuper is meant to be used in overrides where you can call the class you are overriding’s superclass method. Basically a way to skip the class you are overwriting’s method.

    callParent is where you can call the superclass’ method (or in an override the original method you are overriding).

    Giving any array or arguments is the same as using call or apply. You shouldn’t give arguments wrapped in an array. If you know the args you want to pass then use an array with individual arguments: [arg1, arg2].

    I have a couple blogs that may interest you:
    https://mitchellsimoens.com/2015/01/...ent-callsuper/
    https://mitchellsimoens.com/2015/01/...ethods-safely/
    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

  4. #3
    Sencha User
    Join Date
    Apr 2010
    Posts
    40
    Vote Rating
    1
      0  

    Default

    Thanks a lot for the clarification and sorry about not reading the docs carefully enough as the callSuper() doc explains the main difference...my bad.

    Maybe the doc could be updated with the info from your blog.

Similar Threads

  1. Blog post's callParent(arguments) -> callParent([...]);
    By fischer1121 in forum Ext 5: Q&A
    Replies: 2
    Last Post: 13 Aug 2014, 9:10 AM
  2. [INFOREQ] 5.0.1: callParent(arguments) in RowModel.onLastFocusChanged() fails
    By stephanschuster in forum Ext 5: Bugs
    Replies: 2
    Last Post: 8 Aug 2014, 11:23 PM
  3. Replies: 4
    Last Post: 3 Mar 2014, 6:16 AM
  4. Replies: 6
    Last Post: 24 Feb 2012, 10:56 PM
  5. [FIXED] [4.0.6, trunk]: callParent ([arguments])
    By enw in forum Ext:Bugs
    Replies: 1
    Last Post: 20 Oct 2011, 5:46 PM

Posting Permissions

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