var buttonModel = function () {this.modelType = 0; //預設檢視模式this.getModelType = function () {return this.modelType;}}Ext.define('G_buttonModel', {getModelType: function () {return buttonModel.modelType;},setModelType: function (type_num) {buttonModel.modelType = type_num;}});
2>V120103.js
Ext.onReady(function () {
var TMSingleViewEdit = Ext.create('TMSingleViewEdit');:
var gridstore = Ext.getCmp('grid_Single').store;
var buttonModel = Ext.create('G_buttonModel');
Ext.getCmp('btn_save').setFormValue = function () {
//要判斷 buttonModel 的編輯模式時, 才即時去抓 modelType
var modelType = buttonModel.getModelType();
console.log("setFormValue modelType=", modelType);
var modelType = buttonModel.getModelType();
console.log("setFormValue modelType=", modelType);
//若非[新增]模式,則不設定欄位值
if (!(modelType == 1))
return true;
if (!(modelType == 1))
return true;
var isOk = true;
var Tmp_MAX_ITM = "";
np = {};
np["CLS"] = Ext.getCmp('CLS').getValue();
Ext.Ajax.request({
method: "POST",
url: '../../api/V120103API/GET_MAXITM',
params: np,
async: false,
success: function (response, opts) {
var Tmp_Obj = Ext.decode(response.responseText);
if (Tmp_Obj["success"]) {
Tmp_MAX_ITM = Tmp_Obj['MAX_ITM'];
Ext.getCmp("ITM").setValue(Tmp_MAX_ITM);
}
}, // end of success
failure: function (response, opts) {
isOk = false;
}
}); // end of Ext.Ajax
return isOk;
}
沒有留言:
張貼留言