Results 1 to 6 of 6

Thread: NavigationView: [ERROR]Setting activeItem to be a non-inner item

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    11
    Vote Rating
    0
      0  

    Default NavigationView: [ERROR]Setting activeItem to be a non-inner item

    I'm probably doing something stupid, but I really have no idea what. Using the RC version of Sencha 2 I'm modifying the CityBars sample (using Designer, but I don't think that is the issue) to learn how to use the NavigationView. I've created a test view but when I push it to the Navigation view I get an error:

    Uncaught Error: [ERROR][Ext.Container#setActiveItem] Setting activeItem to be a non-inner item
    sencha-touch-all-debug.js:25192

    I've added a button push event to the Businesses controller in the sample with the following code:

    ============== start code =============
    if (!this.testContainer) {
    this.testContainer = Ext.create('CityBars.view.TestContainer', {title: 'Test'
    });
    }
    this.getMainNav().push(this.testContainer);

    ======== end code =============
    The error occurs on the final line. But if I change it to:


    this.getMainNav().push({
    title: 'Second',
    html: 'Second view'
    });

    then there is no problem and a new view is created and shown. But the problem does still occur if I create my custom view in the push method. So it seems to me that there is something wrong with my view:

    ============== start code -- first view file =============
    Ext.define('CityBars.view.TestContainer',
    { extend: 'CityBars.view.ui.TestContainer',
    initialize: function() {
    var me = this;
    me.callParent(arguments);
    }
    });

    ===================== second view file =============
    Ext.define('CityBars.view.ui.TestContainer',
    { extend: 'Ext.Container',
    config: {
    border: 20,
    centered: true,
    id: 'testContainerView',
    layout: {
    type: 'vbox'
    },
    items: [{
    xtype: 'label',
    border: 20,
    html: 'The TestContainer'
    }]
    }
    });
    ======================== end code ===============

    I've also tired creating my view with 'CityBars.view.ui.TestContainer' but with the same results. In both cases the object is created but push does not like it.

    I must be missing something really basic. Any help would be greatly appreciated.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    I'm simply using this to test:

    Code:
    Ext.create('Ext.navigation.View', {
        fullscreen : true,
        items      : [
            {
                title : 'Root',
                items : [
                    {
                        xtype   : 'button',
                        text    : 'Add',
                        handler : function(btn) {
                            var view = btn.up('navigationview');
    
                            var cmp = new Ext.Container({
                                html  : 'Hello',
                                title : 'Works'
                            });
    
                            view.push(cmp);
                        }
                    }
                ]
            }
        ]
    });
    Everything works fine there so you can indeed pass an already instantiated component.

    Does it work the first time but not the second time in your code?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    11
    Vote Rating
    0
      0  

    Default

    I've been doing some poking around with it, and it seems to have some something to do with the CityBars project (or some modification I made to it in my ignorent experimentation).

    If I start a new project and take the same steps everything works fine. So I'm willing to just chalk this up to one of those things and get on with development if it doesn't reoccur in a different context.

    However, in case anyone runs into a similar issue, there is one additional symptom. If I make my custom view the initial view it comes up disabled -- it is greyed out and buttons won't react to taps (their code doesnt get fired but also their pressed andimation does not happen) etc. I would guess that this is related to the error.

    But I don't get this with a new project either. Weird, but not a problem as long as it doesn't reappear. I could send you the test project if you want to follow it up, but from my perspective there is no need.

    Thanks for your help.

  4. #4
    Sencha User
    Join Date
    Aug 2012
    Location
    Vancouver, Canada
    Posts
    31
    Vote Rating
    2
      0  

    Default

    I had the same problem he did, but the error went away if I removed
    centered: true,


  5. #5
    Sencha Premium Member
    Join Date
    Mar 2014
    Posts
    2
    Vote Rating
    0
      0  

    Default Same problem

    Quote Originally Posted by trevorcox View Post
    I had the same problem he did, but the error went away if I removed
    centered: true,

    Even I have the same problem and it goes away if I remove centered:true
    Anyone know what might be the root cause? I need to center the elements.
    I am using Sencha touch 2.4

  6. #6
    Sencha User
    Join Date
    May 2011
    Location
    Gainesville, FL
    Posts
    228
    Vote Rating
    27
      0  

    Default

    Docked, absolute positioned, and, to the best of my knowledge, "centered" items are not inner items. If you want to get it pushed, while centering it within Touch's component system, I would nest it within a vanilla container before adding it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •