Results 1 to 5 of 5

Thread: Error driving me crazy

  1. #1
    Sencha User
    Join Date
    Jun 2013
    Posts
    151
    Answers
    1
    Vote Rating
    1
      0  

    Default Unanswered: Error driving me crazy

    Hi,
    it's happening a problem on application navigation.

    From a menu form containig several buttons if I press one I navigate to a certain form of my application.
    Ok.

    I added in the navigation bar a home page which makes me return to the main menu.

    on the main controller I have a method like:

    Code:
    onMainMenuSaldoPuntiSubmitTap: function(button, e, eOpts) {
    
    button.up('navigationview').push({
        xtype: 'saldoPunti',
        title: 'Premi'
    });
    onNavigationViewActiveItem change I have:

    Code:
    var currentViewId = container.getActiveItem().id;
    
    Ext.ComponentQuery.query('#navigationView')[0].getNavigationBar().rightBox.removeAll();
    if (currentViewId != 'mainMenu' && currentViewId != 'accesso')
    {
        var mainMenu = Ext.ComponentQuery.query('#mainMenu')[0];
        mainMenu.showHomeButton();
    }
    if (currentViewId == "listaSpesa")
    {
        var listaSpesa = this.getListaSpesa();
        listaSpesa.showNewButton();
    }
    else if (currentViewId == "listaSpesaDett")
    {
        var listaSpesaDett = this.getListaSpesaDett();
        listaSpesaDett.showNewButton();
    }
    that in practice makes appear the home button if I'm not on MainMenu

    and the method that makes me return to the main Menu when the button is pressed is:

    Code:
    showHomeButton: function() {
    
    Ext.ComponentQuery.query('#navigationView')[0].getNavigationBar().rightBox.add({
        xtype:'button',
        text:'H',
        id:'btnHome',
        listeners:
        {
            tap: function(button)
            {
                Ext.ComponentQuery.query('#navigationView')[0].reset();
                Ext.ComponentQuery.query('#navigationView')[0].push({
                    xtype: 'mainMenu',
                    title: 'Menu'
                });
            }
        },
        style:'background-image: url(\'resources/images/home_64.png\');\r\n	background-repeat: no-repeat;\r\n	background-position:top;',
    align:'right'});
    Ok, if I press home button and repress the same menu button I get a :

    Uncaught TypeError: Cannot call method 'detach' of null in Chrome debugger!!!!

    googling I found

    http://stackoverflow.com/questions/1...-time-not-work

    that tells about listeners get lost. very annoying.

    The strange thing is if I deploy in certain Android device it goes all right ant to another app stops working.

    Pls help. thanks a lot!

  2. #2
    Sencha User
    Join Date
    Jun 2013
    Posts
    151
    Answers
    1
    Vote Rating
    1
      0  

    Default

    I try to semplify:

    I have a button in a form, clicking it I push another view where's another button.

    If i click this new button I return to the previous form and next time I click the button inside I get


    Uncaught TypeError: Cannot call method 'detach' of null and all stops working

    here the code of the "called" formView

    Code:
    Ext.define('PurchaseApp.view.Impostazioni', {
        extend: 'Ext.form.Panel',
        alias: 'widget.impostazioni',
    
        config: {
            id: 'Impostazioni',
            padding: '12px',
            defaults: {
                labelWidth: '35%'
            },
            items: [
                {
                    xtype: 'button',
                    id: 'btnTest',
                    itemId: 'mybutton16',
                    text: 'MyButton16'
                }
            ],
            listeners: [
                {
                    fn: 'onBtnTestTap',
                    event: 'tap',
                    delegate: '#btnTest'
                }
            ]
        },
    
        onBtnTestTap: function(button, e, eOpts) {
            Ext.ComponentQuery.query('#navigationView')[0].reset();
            Ext.ComponentQuery.query('#navigationView')[0].push({
                xtype: 'mainMenu',
                title: 'Menu'
            });
        },
    
        Initialize: function(record) {
    
        }
    
    });

    don't know what to say.

  3. #3
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Answers
    132
    Vote Rating
    100
      0  

    Default

    It'd be better for readers if you formatted your code examples with the CODE tags

  4. #4
    Sencha User
    Join Date
    Jun 2013
    Posts
    151
    Answers
    1
    Vote Rating
    1
      0  

    Default

    sorry about that jerome76.

    I just found and applied the tag.

  5. #5
    Sencha User
    Join Date
    Jun 2013
    Posts
    151
    Answers
    1
    Vote Rating
    1
      1  

    Default

    I found a workaround by using a pop instead of a push...

    otherwise absolutely for me no way to get out of that.

    Thanks to everybody anyway!

Posting Permissions

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