1. #1
    Sencha User cyberwombat's Avatar
    Join Date
    Oct 2011
    Posts
    237
    Answers
    6
    Vote Rating
    2
    cyberwombat is on a distinguished road

      0  

    Default Unanswered: Toolbar remove/insert issue

    Unanswered: Toolbar remove/insert issue


    I have a view where I insert a button in my toolbar
    Code:
     init: function() {
             this.getController("Viewport").getViewportToolbar().insert(2, {xtype: "button", iconCls: 'info', cls: "viewportGoButton", view: "Invite", align : 'right', hidden: false});
    
    
        },
    Code:
    Then I go to another view - this button is still present - I now want to remove it and add another:
     init: function() {
            this.getController("Viewport").getViewportToolbar().removeAt(2);
            this.getController("Viewport").getViewportToolbar().insert(2, {xtype: "button", iconCls: 'info', cls: "viewportGoButton", view: "Invite", align : 'right', hidden: false});
    
    
        },
    However this gives me the error:
    Code:
    Uncaught TypeError: Cannot read property 'dom' of null
    Ext.define.insertItemsencha-touch-all-debug.js:32577
    Ext.define.doItemAddsencha-touch-all-debug.js:32350
    Base.implement.callParentsencha-touch-all-debug.js:2768
    Ext.define.doItemAddsencha-touch-all-debug.js:32677
    Ext.define.onItemAddsencha-touch-all-debug.js:32312
    Ext.define.onAdd
    If I do not use remove I have 2 buttons. If I use '3' for the new button it doesn't show.

    How do I replace buttons without getting this error?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Answers
    3462
    Vote Rating
    827
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    This is working for me against our latest code:

    Code:
            Ext.create('Ext.Panel', {
                fullscreen : true,
                items      : [
                    {
                        xtype  : 'toolbar',
                        docked : 'top',
                        items  : [
                            {
                                text    : 'Test',
                                handler : function(btn) {
                                    var toolbar = btn.up('toolbar');
    
                                    toolbar.removeAt(2);
                                    toolbar.add({
                                        text : 'New',
                                        ui   : 'confirm'
                                    });
                                }
                            },
                            {
                                text : 'Another Button'
                            },
                            {
                                text : 'Remove Me'
                            }
                        ]
                    }
                ]
            });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User cyberwombat's Avatar
    Join Date
    Oct 2011
    Posts
    237
    Answers
    6
    Vote Rating
    2
    cyberwombat is on a distinguished road

      0  

    Default


    It seems to be an issue with align:right and navigationbar. Please try this example - it causes the same issue and does not remove button (though in my app the button gets removed)

    Code:
    xtype  : 'navigationbar',
                        docked : 'top',
                        items  : [
                            {
                                text    : 'Test',
                                handler : function(btn) {
                                    var toolbar = btn.up('navigationbar');
    
    
                                    toolbar.removeAt(2);
                                    toolbar.add({
                                        text : 'New',
                                        ui   : 'confirm',
                                        align: 'right'
                                    });
                                }
                            },
                            {
                                text : 'Another Button'
                            },
                            {
                                text : 'Remove Me'
                            }
                        ]
                    },

  4. #4
    Sencha User cyberwombat's Avatar
    Join Date
    Oct 2011
    Posts
    237
    Answers
    6
    Vote Rating
    2
    cyberwombat is on a distinguished road

      0  

    Default


    Could someone from Sencha please try above code example? Sounds like a bug but would like a more experience dev to try it

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."