I have a login(window) screen and menu which is viewport in my application. In my menu, I have LogOff button. On click of the button I wanted to remove the viewport and display the Login screen.
I am using the below code in the LogOff button click event

button.up('viewport').removeAll();
var l=Ext.create('TestApp.view.Login');
l.show();

The above code while executing calls the "afterlayout" event of the viewport and gives error.

Please help me to close the viewport.
Thanks