button click action to close view with extjs 4 -


i have login form when click connect button want go view , close thhe login view.

it souce code:

login view

ext.define('ext4example.view.login.loginform' ,{  extend: 'ext.form.formpanel', alias : 'widget.login',  bodystyle: "background-image:url('resources/images/logo.png')", margin: '100 50 10 450', width:500, height:320, frame: true, initcomponent: function() { this.items= [{     xtype: 'textfield',     name : 'id',     fieldlabel: 'id',     hidden:true }, {         xtype: 'textfield',         x:100,         y:100,         cls:'user',         emptytext : "votre nom d'utilisateur...",         fieldlabel:"nom d'utilisateur",         name:'j_username',        },{         xtype: 'textfield',         x:100,         y:100,         emptytext : "votre mot de passe...",          name:'j_password',         fieldlabel:'mot de passe'      },       {              xtype: 'checkbox',             boxlabel: 'rester connecte',             x:100,             y:110,             allowblank: false},             {xtype: 'button',                 text:'connexion',                 action: 'connect',                  margin:'120 0 0 170',                 name:'connect'             },                   {xtype: 'button',                     margin:'120 20 0 20',                     text:' annuler ',                     action: 'reset',                         name:'reset',                  },             {                 xtype: 'tbtext',                 text: 'copyright ©  tous droits réservés',                 margin: '64 0 0 58',                }     ], this.callparent(arguments); }   });     

home view

ext.define('ext4example.view.login.homepage' ,{ extend: 'ext.container.viewport',  alias : 'widget.home',  requires: [            'ext4example.view.login.westmenu',            'ext4example.view.login.centerpanel'         ],        layout: {            type: 'border',            padding: '0 5 5 5'        },  initcomponent: function() {   this.items= [      {      xtype: 'westmenu',     region: 'west' },{      xtype: 'portletpanel',     region: 'center', } ],      this.callparent(arguments); } });     

my controller

ext.define('ext4example.controller.login', { extend: 'ext.app.controller',  stores: ['login'],  models: ['login'],  views: ['login.loginform','login.homepage','login.centerpanel','login.westmenu'],   init: function() {       this.control({         'login button[action=add]': {            },          'login button[action=reset]': {               'click' : function(button, event, opt) {                    var form = button.up('form');                 form.getform().reset();             }           },          'login button[action=connect]': {                'click' :this.connect         }     });  },  connect:function(button,record)  {  var view1 = ext.widget('home');   } 

});

when click on button connect see 2 views on same page want login view desappear , want show home view.

any 1 have solution ?

try:

var win = button.up('login'); win.close(); 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -