Search code examples
javascriptextjssencha-touch-2

Extend platformConfig property of Ext.form.Panel


I'm trying to overide a global platformConfig of a Ext.form.Panel class.

I'm trying to do this to avoid defining the same platFormConfig on every view that is extending Ext.form.Panel. I'm trying to avoid to create a intermediate baseclass like My.form.Panel just for adding a platformConfig property.

What I've tried so far:

Ext.form.Panel.addMember('platformConfig',  [{
        platform: ['windows'],
        scrollable: 'vertical'
}]);

But this doesn't apply to the inherited view classes. Is there a clean solution for extending a Ext/Sencha base class?

Thanks in advance - any help is appreciated!


Solution

  • Well, to override, I would use override:

    Ext.define('MyOverride',{
        override:'Ext.form.Panel', // <- this is an override!
        platformConfig:{
            ...
        }
    });
    

    The override definition should take place either in Ext.onReady or in the application init method.

    This would then apply to inherited view classes as well - unless the platformConfig is overridden there again.