title: How to hide button is Sencha Touch 2.1
body: <p>I've found similar questions on this site but none of the answers has been working for me. This is button I want to hide (view):</p>
  
  <pre><code>{
          xtype: 'button',
          id: 'btn_messenger',
          text: 'Messenger'
      }
  </code></pre>
  
  <p>Controller for that view has init function:</p>
  
  <pre><code>init : function() {
      var me = this;
      me.callParent();
      me.hideMessengerButton(me);
  }
  </code></pre>
  
  <p>This is the function that should hide button:</p>
  
  <pre><code>hideMessengerButton: function(me) {
      var user = me.getLoggedUser(); // return user or undefined
      if (user == undefined) {
          Ext.select('#btn_messenger').hide(); // Does nothing
      }
  }
  </code></pre>
  
  <p>I've tried these options:</p>
  
  <p><code>Ext.getCmp('btn_messenger').hide(); // Ext.getCmp('btn_messenger') returns undefined</code></p>
  
  <p><code>Ext.getCmp('#btn_messenger').hide(); // Ext.getCmp('#btn_messenger') returns undefined</code></p>
  
  <p>In controller's refs there is <code>btn_messenger: '#btn_messenger'</code>, so I've tried:</p>
  
  <p><code>this.getBtn_messenger().hide() // this.getBtn_messenger() returns undefined</code></p>
  
  <p>Thanks for help in advance.</p>
  
  <p>PS.: I don't know if this matters but the view mentioned above is not the main view. It is pushed after button tap on the main view.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Here is the controller:</p>
  
  <pre><code>Ext.define('First.controller.HomePage', {
  extend : 'First.controller.Controller',
  requires : ['First.view.Main', 'First.view.HomePage'],
  
  config : {
      refs : {
          pnl_home: 'pnl_home',
          btn_messenger : '#btn_messenger'
      },
  
      control : {
          btn_messenger : {
              tap : 'btn_openMessenger'
          }
          pnl_home: {
              show: 'hideMessengerButton'
          }
      },
  },
  
  init : function() {
      var me = this;
      me.callParent();
  },
  
  
  btn_openMessenger : function() {
      Ext.Msg.alert('Open', 'Messenger');
  },
  
  /**
   * Hide meseenger button when user's not logged in
   */
  hideMessengerButton : function() {
      var me = this;
      var user = me.getLoggedUser();
      if (user == undefined) {
          me.getBtn_messenger().setHidden(true);
      }
  }
  </code></pre>
  
  <p>});</p>