I have a button and when ever the user clicks it, i need to show a different view/page (navigate to a different view).
For example, Screen A, has a button, and when i click on that button, i need to navigate to Screen B.
my code is as follows;
onLoginSuccess : function(){
Ext.create('Ext.container.Viewport', {
items: [
{
xtype: 'screenb'
}
]
});
}
but, what hapence is that, When i click on the Button in Screen A, i navigate to Screen B and also Screen A appears on Screen B. I need to get rid of Screen A (after the user clicks the button and show only screen B)
===================== UPDATE 2 =======================================
Ext.define('Proj.view.loca.Person' ,{
extend: 'Ext.form.Panel',
alias : 'widget.person',
items: [
{
xtype: 'textfield',
fieldLabel: 'Name',
name: 'name'
}, {
xtype: 'textfield',
fieldLabel: 'School',
name: 'school'
}],
buttons: [{
text: 'Submit',
handler: function() {
var form = this.up('form').getForm();
if (form.isValid()) {
form.submit({
success: function(form, action) {
Ext.create('Ext.container.Viewport', {
items: [
{
xtype: 'screenb'
}
]
});
},
failure: function(form, action) {
// Navigate to some other view
}
});
}
}
}]
});