Results 1 to 3 of 3

Thread: What is best practice to add button to most Views?

  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    44

    Default What is best practice to add button to most Views?

    I would like to add Login button to some of my views, right now i did in stuped way just added to each view where i need and map to controller.
    Is this here any way to do it in one place?

  2. #2
    Sencha User
    Join Date
    Dec 2012
    Posts
    44

    Default

    Now its a bit better
    Code:
     onViewShow: function(){        this.manageLoginButtonVisibility(this.getMain().getActiveItem());
        },
        onActiveItemChanged:function ( item, value, oldValue, eOpts ) {
            this.manageLoginButtonVisibility(value);
        },
        manageLoginButtonVisibility: function(view){
            var navigationBar = view.getNavigationBar();
            if(navigationBar.query("button[action=loginPopup]").length == 0){
                var button = Ext.create('Ext.Button', {align:'right', action:'loginPopup', text:'Login'});
                navigationBar.add([button]);
            }
        },

  3. #3
    Sencha User
    Join Date
    Jun 2009
    Location
    Italy
    Posts
    1,395
    Answers
    148

    Default

    You can listen for the navigation view "push" event and look for a pushed view configuration param such as:

    Code:
    loginRequired: true
    if this configuration param has been found and is set to "true" then you have to show the button, otherwise you need to hide 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
  •