1. #1
    Sencha User
    Join Date
    Dec 2012
    Location
    Augsburg, Germany
    Posts
    4
    Vote Rating
    0
    fuchsi is on a distinguished road

      0  

    Default Unanswered: Ext.Viewport.setActiveItem does not work after upgrading from 2.0.1 to 2.1

    Unanswered: Ext.Viewport.setActiveItem does not work after upgrading from 2.0.1 to 2.1


    Hi!

    I'm new to Sencha Touch and i'm working on my first bigger App. I started with Sencha Touch 2.0.1 and wanted to upgrade to 2.1 and Sencha cmd. But after upgrading my navigation isn't working in my App. I'm using Ext.Viewport.setActiveItem and redirects for Android to navigate through my app.

    first view:
    Code:
    Ext.define("Myapp.view.opponents.Start", {    extend: 'Ext.Container',
        alias: 'widget.opponents_start_view',
        config:{
            fullscreen: true,
            items:
            [
            {
            xtype: 'titlebar',
                    docked: 'top',
                    title: 'Online or Offline',
                    items:[
                        {
                            xtype: "button",
                            ui: "back",
                            text: "Home",
                            itemId: "back_to_home",
                            
                        }
                    ]
           },
           
           {
                xtype : 'container',
                centered: true,
                layout : {
                    type : 'vbox',
                    align : 'center',
                    pack : 'center'
                        },
    
    
                    items : [{
                        xtype : 'button',
                        text : 'Online',
                        itemId : 'online_game',
                        margin : 3,
                        disabled: true
                    }, 
                    {
                        xtype : 'button',
                        text : 'Offline',
                        itemId : 'offline_game',
                        margin : 3
                    }],
            }
            ]
        }
    });
    third view:
    Code:
    Ext.define("Myapp.view.Offline_game", {    
        extend: 'Ext.Container',
        alias: 'widget.offline_game_view',
        xtype: 'offline_game_view',    
        layout: {
            type: 'vbox',
            
        },
        config:{
            fullscreen: true,
            scrollable: {
            direction: 'vertical'
            },
            items:
            [
                {
                    //titlebar
                    xtype: 'titlebar',
                    docked: 'top',
                    itemId: 'title',
                    title:    'Offline',
                    items:
                    [
                        {
                            xtype: "button",
                            ui: "back",
                            text: "Back",
                            itemId: "backButton"
                        }
                    ]
                },
                {
                 
                            xtype: "button",
                            text: "testbutton",
                            itemId: "testbutton"
                        }
                ]}                        
        });
    the controllers in the same order:
    Code:
    Ext.define('Myapp.controller.opponents.Start', {    extend: 'Ext.app.Controller',
        config:{
            routes:{
                'opponents/Start': 'init_opponents_Start'
            },
            control:{
                'opponents_start_view #back_to_home':{
                    tap: 'on_back_home'
                },
                'opponents_start_view #offline_game':{
                    tap:'on_offline_game'
                }
            }
        },
        
        init_opponents_Start: function(){
            Ext.Viewport.setActiveItem(Ext.create('Cross-SteinScherePapier.view.opponents.Start'));
        },
        
        on_back_home: function(){
            this.redirectTo('Start');
        },
        
        on_offline_game: function(){
            this.redirectTo('Offline_game');
        }
     });
    Code:
    Ext.define('Myapp.controller.Offline_game', {    extend : 'Ext.app.Controller',
        config : {
            routes:{
                'Offline_game': 'init_offline_game'
            },
            refs: {    
                offline_game_view: 'offline_game_view',
                        
            },
            },
        
        
        onback_offline_game: function(){
        },
        
        init_offline_game: function(){
                Ext.Viewport.setActiveItem(Ext.create('Myapp.view.Offline_game'));
        }
    });
    When i click on the Offline_game button i get this error in the browser: Uncaught TypeError: Object #<Object> has no method 'onItemAdd'.
    This error occurs in the Container.js line 1075

    Can you help me please.

  2. #2
    Sencha User
    Join Date
    Dec 2012
    Location
    Augsburg, Germany
    Posts
    4
    Vote Rating
    0
    fuchsi is on a distinguished road

      0  

    Default Help

    Help


    Can anybody help me please?

Tags for this Thread