As the user has the option to log into the application, the user can also log out from it. The logout capability will be the last one that we will implement in the Login Controller.
First, we will add the Header
class as one of the views of the controller:
views: [ 'Login', 'Header', 'authentication.CapsLockTooltip' ]
The next step is to add the click event listener from the Logout button inside the this.control
declaration:
"appheader button#logout": { click: this.onButtonClickLogout }
As the selector, we will use appheader
because this is the xtype
of the toolbar where the Logout button is located, button
because Logout is a button (xtype:
button
), and #logout
because this is its itemId
. This way we make sure ComponentQuery
will retrieve the button that we are looking for.
Then, we need to implement the onButtonClickLogout
method inside the controller:
onButtonClickLogout: function(button, e, options) { Ext.Ajax.request({ url: 'php/logout.php...