Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For all who want to know how I resolved this, I'm now left bald after pulling all my hair out;)</p> <p>All my profile views where I want to have the xtype names remain the same even though they might belong in the phone or tablet profiles, I have to remove the alias/xtype config on the class. I then have a profile base class defined like so with a shared helper function:</p> <pre><code>Ext.define('MyApp.profile.Base', { extend: 'Ext.app.Profile', config: { }, mapViewAliases: function () { var self = this; var views = this.getDependencies().view; var newAliasMap = null; Ext.each(views, function (view) { Ext.Array.some(self.getViewsToAliasMap(), function (map) { if (map[view]) { if (!newAliasMap) { newAliasMap = {}; } newAliasMap[view] = [map[view]]; return true; } }); }); if (newAliasMap) { console.log('view aliases being mapped for: ' + this.$className); Ext.ClassManager.addNameAliasMappings(newAliasMap) } } }); </code></pre> <p>Then I have the profile class inherit from the base class (this is repeated with the tablet profile except the viewsToAliasMap holds classes belonging to the tablet profile instead of the phone profile):</p> <pre><code>Ext.define('MyApp.profile.Phone', { extend: 'MyApp.profile.Base', config: { name: 'Phone', views: ['Login', 'Home', 'Welcome' ], viewsToAliasMap: [ { 'MyApp.view.phone.Login': 'widget.loginview' }, { 'MyApp.view.phone.Home': 'widget.homeview' }, { 'MyApp.view.phone.Welcome': 'widget.welcomeview' } ] }, isActive: function () { return Ext.os.is.Phone; }, launch: function () { console.log("Phone profile launched"); this.mapViewAliases(); } }); </code></pre> <p>So basically, the profile calls the function mapViewAliases() on the base class in the launch function. The mapViewAliases() registers the view class names with the aliases defined in the profile with the class manager. So effectively the xtype names are resolved at run-time.</p> <p>I'm sure this code can be improved and/or a better way to do this. Please feel free to let me know.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload