Hybrid View

  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    30
    Answers
    3
    Vote Rating
    0
    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')
    	);
    }

  3. #2
    Sencha Premium Member
    Join Date
    Mar 2013
    Location
    Driebergen, The Netherlands
    Posts
    69
    Answers
    6
    Vote Rating
    3
    MartineNavara is on a distinguished road

      0  

    Default


    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')
    	);
    }

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

      0  

    Default


    Working now.
    Had also the view Main in my app.js.
    After removing it and copying the whole launch-method and the other fn's to each profile its working great.
    Thanks!

Thread Participants: 1

Tags for this Thread