Threaded View

  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    30
    Vote Rating
    0
    Answers
    3
    Isnogud is on a distinguished road

      0  

    Default Answered: Device Profiles - phone uses tabletviews

    Answered: Device Profiles - phone uses tabletviews


    Hello there!

    I got 2 profiles, phone & tablet which have different controller and different views.

    Phone:
    Code:
    Ext.define('MyApp.profile.Phone', {
        extend: 'Ext.app.Profile',
    
    
        config: {
            controllers: ['MainController'],
            views: ['Main']
        },
    
    
        isActive: function() {
            return Ext.os.is.Phone;
        }
    });
    Tablet:
    Code:
    Ext.define('MyApp.profile.Tablet', {
        extend: 'Ext.app.Profile',
    
    
        config: {
            controllers: ['MainController'],
            views: ['Main'],
            stores: ['MyTabletStore'],
            models: ['MyTabletModel']
        },
    
    
        isActive: function() {
            return Ext.os.is.Tablet || Ext.os.is.Desktop;
        }
    });
    Right after everything is loaded, the tablet-view is shown. Always. On every device.
    Even if I would use the launch function in one of the profiles, the phone view is not shown.
    What am I doing wrong? Its like the tablet-profile is overriding the phone-profile.

  2. You didn't specify an launch in your profiles. Now it is only calling launch of app.js and I think your launch of app.js is loading the view from your tablet. You should remove the create of the main view from app.js and add them to the launch functions of your profiles.

    For example:
    Code:
    launch : function() {
    		Ext.Viewport.add(
    		Ext.create('AppName.view.phone.Main')
    	);
    }

Thread Participants: 1

Tags for this Thread