2
上Ext.onReady関数を呼び出しますボディ上のウィンドウを閉じることができるExample.Formクラス。 (成功の結果が提出され、開いている窓の本体が閉じられたとき)ExtJSには、私は、この構造体を持っているクラス
私は悪い英語をお詫びします。
上Ext.onReady関数を呼び出しますボディ上のウィンドウを閉じることができるExample.Formクラス。 (成功の結果が提出され、開いている窓の本体が閉じられたとき)ExtJSには、私は、この構造体を持っているクラス
私は悪い英語をお詫びします。
コードの構造は、xtypesとして登録しているコンポーネントを格納する場所を許可する必要があります。また、アプリケーションを構成するコンポーネントのトップレベルの名前空間も必要です。こうすることで、いつでもアプリの部品を参照することができます。コントローラロジックを分解することも良い考えです。小さなアプリの場合、1つのコントローラーがうまくいくかもしれませんが、アプリが大きくなると、それぞれのコントローラーを1つずつ持つことができます。
ここには、この例で入力したコードの修正版があります。成功イベントを処理し、上記の推奨事項に適合するように構成されています。
Ext.ns('Example');
/* store components to be used by app */
Ext.ns('Example.lib');
/* store instances of app components */
Ext.ns('Example.app');
Example.lib.Form = Ext.extend(Ext.form.FormPanel, {
// other element
// moved to app controller
//onSuccess:function(form, action) {
//}
});
Ext.reg('exampleform', Example.lib.Form);
Example.lib.FormWindow = Ext.extend(Ext.Window,{
initComponent: function(){
/* add the items */
this.items ={itemId:'add', xtype:'exampleform'};
/* ext js requires this call for the framework to work */
Example.lib.FormWindow.superclass.initComponent.apply(this, arguments);
}
});
Ext.reg('exampleformwin', Example.lib.FormWindow);
/*
manage/control the app
*/
Example.app.appController = {
initApp: function(){
Example.app.FormWindow = Ext.create({xtype:'exampleformwin', id:'formloadsubmit-win'});
Example.app.FormWindow.show();
/* get a reference to the 'add' form based on that item id and bind to the event */
Example.app.FormWindow.get('add').on('success', this.onAddFormSuccess, this);
},
/* the logic to handle the add-form's sucess event */
onAddFormSuccess: function(){
Example.app.FormWindow.hide();
}
}
Ext.onReady(function() {
/* start the app */
Example.app.appController.initApp()
})
tnx.what about buttons.howボタンを定義できます。 –
ボタンではありません!私の歯茎ドロップボタンではありません! http://www.youtube.com/watch?v=FpBJih02aYU – HDave