2017-10-22 11 views
0

私は、ext framework 6.2.0のadmin-dashbordというテンプレートを使用しています。ビューの子からビューの親を閉じるにはどうすればいいですか?

私はこれを使用すると、私のAuthenticationControllerに

this.getView().destroy(); 

唯一の子ビューでのログインが親をclose.Not。

app-mainコンポーネントは親ビューの背後にビルドされています。

親ビューを閉じる方法がわかりません。

私はこの次の構造を持っている:

LoginWindow.js

Ext.define('Admin.view.authentication.LockingWindow', { 
    extend: 'Ext.window.Window', 
    xtype: 'lockingwindow', 

    requires: [ 
     'Admin.view.authentication.AuthenticationController', 
     'Ext.layout.container.VBox' 
    ], 

    cls: 'auth-locked-window', 
    closable: false, 
    resizable: false, 
    autoShow: true, 
    titleAlign: 'center', 
    maximized: true, 
    modal: true, 

    .... 

}); 

Login.js

Ext.define('Admin.view.authentication.Login', { 
    extend: 'Admin.view.authentication.LockingWindow', 
    xtype: 'login', 

    requires: [ 
     'Admin.view.authentication.Dialog', 
     'Ext.container.Container', 
     'Ext.form.field.Text', 
     'Ext.form.field.Checkbox', 
     'Ext.button.Button' 
    ], 

    title: 'Let\'s Log In', 
    defaultFocus: 'authdialog', // Focus the Auth Form to force field focus as well 
.... 

      { 
       xtype: 'button', 
       reference: 'loginButton', 
       scale: 'large', 
       ui: 'soft-green', 
       iconAlign: 'right', 
       iconCls: 'x-fa fa-angle-right', 
       text: 'Login', 
       formBind: true, 
       listeners: { 
        click: 'onLoginButton' 
       } 
      }, 

}); 

AuthenticationController.js

Ext.define('Admin.view.authentication.AuthenticationController', { 
    extend: 'Ext.app.ViewController', 
    alias: 'controller.authentication', 

    onLoginButton: function() { 

     var me = this; 

     localStorage.setItem("TutorialLoggedIn", true); 

     // Remove Login Window 

     this.getView().destroy(); 

     // Add the main view to the viewport 
      var main = Ext.create({ 
      xtype: 'app-main' 
     }); 

     me.redirectTo('dashboard', true); 
    }, 

}); 

答えて

0
  1. ビューを取得:LockingWindow
  2. は親を破壊する:親を取得し
  3. ログインここLockingWindow

することは、私の方法はAuthenticationController.jsに追加され、onLoginButton()メソッドで呼び出されます。

createInterface : function(){ 

     var me = this, 
      view = me.getView(), 
      window = view.up('window'); 

     Ext.create({ 
      xtype: 'app-main' 
     }); 
     window.destroy(); 

     me.redirectTo('dashboard', true); 
} 
関連する問題