Results 1 to 3 of 3

Thread: Menu (buttons) strange behaviour on hide/toggle

  1. #1
    Sencha Premium User
    Join Date
    Oct 2015
    Posts
    27

    Default Menu (buttons) strange behaviour on hide/toggle

    Hi guys,

    I have a Main.js with a menu opened by a tool and inside the menu is a button to logout.
    When I click logout I destroy the main view and tried to hide all menus or toggle my menu on the right side but whenever I do this the menu buttons take some time to disappear. I recorded it here.

    How can I fix this?


    Thanks in advance!


    Regards,
    Phil






    Main.js

    Code:
    Ext.define('OrderList.view.main.Main', {    extend: 'Ext.Panel',
    
        xtype: 'app-main',
        itemId: 'mainPanel',
    
        layout: 'fit',
    
        requires: [
            'OrderList.view.main.MainController',
            'OrderList.view.main.MainModel',
            'OrderList.view.orders.OrdersNavigation'
    ],
    
        controller: 'main',
        viewModel: 'main',
        title: 'Auftragsübersicht',
    
        tools: [
            {
                type: 'side-menu',
                handler: function () {
                    if (Ext.Viewport.getMenus().right.isHidden()) {
                        Ext.Viewport.showMenu('right');
                    }
                    else {
                        Ext.Viewport.hideMenu('right');
                    }
                }
            }
        ],
    
        initialize: function () {
            Ext.Viewport.setMenu(this.createMenu(), {
                side: 'right',
                reveal: true
    })
        },
    
        createMenu: function () {
            var that = this;
    
            var menu = Ext.create('Ext.Menu', {
    
                itemId: 'mainMenu',
    
                // width: 250,
    scrollable: 'vertical',
    
                items: [
                    {
                        xtype: 'button',
                        text: 'Option 1'
    },
                    {
                        xtype: 'button',
                        text: 'Option 2'
    },
                    {
                        xtype: 'button',
                        text: 'Logout',
                        iconCls: 'x-fa fa-power-off',
                        handler: function () {
                            console.log('Logout tapped'),
                                Ext.GlobalEvents.fireEvent('logout')
                        }
                    }
                ]
            });
            return menu;
        },
    
    [...]
    
    MainController.js

    Code:
    actionLogout: function () {    // Remove localStorage
    sessionStorage.removeItem('mySessionID');
    
        var loginView = Ext.create({xtype: 'login'});
        if (Ext.Viewport.add) {
            Ext.Viewport.add(loginView);
        }
    
        Ext.Viewport.toggleMenu('right');
        this.getView().destroy();
    }

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,257
    Answers
    759

    Default

    The likely cause is because they are both animating. toggling the menu and destroying the view (sliding the card) at the same time.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha Premium User
    Join Date
    Oct 2015
    Posts
    27

    Default

    Quote Originally Posted by evant View Post
    The likely cause is because they are both animating. toggling the menu and destroying the view (sliding the card) at the same time.
    Okay, so is it possible to suppress to animation of the menu so that it just disappears? Might this help?

Similar Threads

  1. Replies: 3
    Last Post: 4 Aug 2011, 8:14 PM
  2. [INFOREQ] ExtJS 4.0.2a Strange Menu Hovering Behaviour. Is it a bug?
    By setchi in forum Ext:Bugs
    Replies: 3
    Last Post: 28 Jun 2011, 3:41 AM
  3. Wierd Hide / Unhide behaviour in toolbar buttons
    By manugoel2003 in forum Community Discussion
    Replies: 6
    Last Post: 19 Sep 2007, 5:43 AM

Tags for this Thread

Posting Permissions

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