Notifications
Clear all

Calling Superclass function in ExtJS

2 Posts
3 Users
3 Reactions
1,072 Views
1
Topic starter

How do I call superclass fucntion in ExtJS? I am overriding a method isChildGridValid in ModelFormPanel and would like to call the base implementation of this method before customizing.

2 Answers
2

If you're using Ext.extend, you can call the superclass function using the following pattern:

// pattern
<YourClass>.superclass.<Function>.apply(this, arguments);

// example
One.model.ModelFormContainer.superclass.getCurrentPage.apply(this, arguments);

Your case is special, though, because you don't have a class that directly extends One.model.ModelFormPanel (you're probably extending One.model.ModelFormContainer and modifying the config for the panel using one of the config objects). This also happens when you use Ext.override, so you have to use the following:

// pattern
<Superclass>.prototype.<Function>.apply(this, arguments);

// example
One.model.ModelFormPanel.prototype.isChildGridValid.apply(this, arguments);
0

One.model.ModelFormPanel.superclass.isChildGridValid.call(this, arguments);