2022年7月18日 星期一
V120502 - ComboBox 加入選項 - ComboBox 加入本機 [印表機選項]
Web V120502 - store 刪除資料
console.log("Tmp_sub_Grid:", Tmp_sub_Grid);
var cur_recs;
var cur_rec;
cur_recs = Tmp_sub_Grid.selModel.getSelection();
if (cur_recs.length == 0) {
mywarnalert("請先選擇要刪除的資料");
return;
}
else {
cur_rec = cur_recs[0];
console.log("cur_rec:", cur_rec);
console.log("Tmp_sub_Grid.store:", Tmp_sub_Grid.store);
Tmp_sub_Grid.store.remove(cur_rec);
mysuccessalert("刪除資料完成 !!");
return;
}
2022年7月14日 星期四
Web V120502 - store 加入新資料(add)
目的: 在Grid(store) 加入資料
問題: 1>如何在Grid(store)加入新資料
var Tmp_Str = '';
var Tmp_Grid = Ext.getCmp('grid_Single');
var Tmp_store = Tmp_Grid.store; //= gridstore
var Tmp_sub_Grid = Ext.getCmp('sub_Grid');
var Tmp_sub_store = Tmp_sub_Grid.store; //= gridstore
var Tmp_PageCnt = Tmp_store.getCount();
console.log("分頁共 N 筆 , Tmp_PageCnt =", Tmp_PageCnt);
var cur_rec, Tmp_AMMNO, Tmp_CHECK, Tmp_SAPNO, Tmp_PN, Tmp_QTY, Tmp_EOCND, Tmp_RMK ;
var Tmp_OK = true;
var np = {};
for (i = 0; i < Tmp_PageCnt; i++) {
//console.log("更新第 i 筆", i);
//依目前 store的資料, 更新 AMM_FACDEPD.NWK , PK( DT+DEP+EMPLYID)
cur_rec = Tmp_store.getAt(i);
Tmp_AMMNO = cur_rec.data["AMMNO"];
Tmp_CHECK = cur_rec.data["CHECK"];
console.log("1 Tmp_AMMNO=", Tmp_AMMNO);
console.log("1 Tmp_CHECK=", Tmp_CHECK);
Tmp_SAPNO = cur_rec.data["SAPNO"];
Tmp_PN = cur_rec.data["PN"];
Tmp_QTY = cur_rec.data["QTY"];
if (!checkisnull(cur_rec.data["ECNO"])) {
Tmp_EOCND = cur_rec.data["ECNO"] + "+" + cur_rec.data["CNDPROCCODE"];
}
else {
Tmp_EOCND = "";
}
Tmp_RMK = cur_rec.data["ACNO_"];
//若主畫面資料有勾選,則加入 sub_store
if (Tmp_CHECK) {
var sub_Store_np = {
SAPNO: Tmp_SAPNO,
PN: Tmp_PN,
QTY: Tmp_QTY,
EOCND: Tmp_EOCND,
RMK: Tmp_RMK,
}
Tmp_sub_store.add(sub_Store_np);
}
} // end of for i=
} // end of function mySub2_OkBtn_click()
Web V120502 –選擇行 -加入checkbox 選擇Row , 行允許多選
目的: 以 checkbox 選擇行, 且允許多選
問題: 1>如何在每一行開頭,加入checkbox (xtype: 'checkcolumn')
2>依勾選資料處理(可多選)
處理說明:
1>在每一行開頭,加入 checkbox
{ header: "", xtype: "rownumberer", width: 50, align: "center", sortable: false },
{
header: '勾選',
dataIndex: 'CHECK',
xtype: 'checkcolumn',
width: 60,
renderer: function (value, metadata, record, rowIndex, colIndex, store) {
var tempVal = '';
if ((value === 'Y') || (value === true)) { tempVal = 'checked'; }
var Tmp_Str = "<input type='checkbox' name=" + (record.get('AMMNO')) + " " + tempVal + " >";
return Tmp_Str;
},
}, // end of header='[ ]勾選'
{header:"AMM單號",dataIndex:"AMMNO",width:150,TMType:"string"},
{header:"AMM單況",dataIndex:"AMMSTS",width:75,TMType:"string"},
{header:"AMM單況說明",dataIndex:"AMMSTS_"},
{header:"工號",dataIndex:"SAPNO",width:120,TMType:"string"},
{header:"件號",dataIndex:"PN",width:150,TMType:"string"},
];
2>依勾選資料處理(可多選)
var Tmp_Str = '';
var Tmp_Grid = Ext.getCmp('grid_Single');
var Tmp_store = Tmp_Grid.store; //= gridstore
var Tmp_sub_Grid = Ext.getCmp('sub_Grid');
var Tmp_sub_store = Tmp_sub_Grid.store; //= gridstore
var Tmp_PageCnt = Tmp_store.getCount(); //store筆數
var cur_rec, Tmp_AMMNO, Tmp_CHECK, Tmp_SAPNO, Tmp_PN, Tmp_QTY, Tmp_EOCND, Tmp_RMK ;
var Tmp_OK = true;
var np = {};
var sub_Store_np = {};
var Tmp_SelCnt = 0;
//將主畫面勾選的資料, 加入子視窗.DBGrid
for (i = 0; i < Tmp_PageCnt; i++) {
//console.log("更新第 i 筆", i);
//依目前 store的資料, 更新 AMM_FACDEPD.NWK , PK( DT+DEP+EMPLYID)
cur_rec = Tmp_store.getAt(i);
Tmp_AMMNO = cur_rec.data["AMMNO"];
Tmp_CHECK = cur_rec.data["CHECK"];
//console.log("1 Tmp_AMMNO=", Tmp_AMMNO);
//console.log("1 Tmp_CHECK=", Tmp_CHECK);
Tmp_SAPNO = cur_rec.data["SAPNO"];
Tmp_PN = cur_rec.data["PN"];
Tmp_QTY = cur_rec.data["QTY"];
if (!checkisnull(cur_rec.data["ECNO"])) {
Tmp_EOCND = cur_rec.data["ECNO"] + "+" + cur_rec.data["CNDPROCCODE"];
}
else {
Tmp_EOCND = "";
}
Tmp_RMK = cur_rec.data["ACNO_"];
//若主畫面資料有勾選,則加入 sub_store , sub_store 不分頁
if (Tmp_CHECK) {
sub_Store_np = {
SAPNO: Tmp_SAPNO,
PN: Tmp_PN,
QTY: Tmp_QTY,
EOCND: Tmp_EOCND,
RMK: Tmp_RMK,
}
Tmp_sub_store.add(sub_Store_np);
}
} // end of for i=
Tmp_SelCnt = Tmp_sub_store.getCount();
if (Tmp_SelCnt == 0) {
mywarnalert("請先選擇要列印的資料 !!");
//console.log("Ext.getCmp('sub_Grid'):", Ext.getCmp('sub_Grid'));
//Ext.getCmp('sub_Grid').up('window').close();
//Ext.getCmp('sub_Grid').up('window').destroy();
return;
}
Web改版 - V120902- CheckBox欄位編輯處理
Web改版V120902 – 出勤現況維護 –
目的: 以Checkbox編輯欄位值
問題: 1>如何在 Grid Columns 加入 CheckBox
2>如何在後端讀取 CheckBox欄位值
Q1>如何在 Grid Columns 加入 CheckBox
Ans: 1>於Grid的 Columns加入一欄位 : xtype: 'checkColumn',
{header: '缺勤',
dataIndex: 'NWK',
xtype: 'checkcolumn',
:
}
for (i = 0; i < Tmp_TotalCnt; i++) {
console.log("更新第 i 筆", i);
//依目前 store的資料, 更新 AMM_FACDEPD.NWK , PK( DT+DEP+EMPLYID)
cur_rec = Tmp_store.getAt(i);
Tmp_DT = cur_rec.data["DT"];
Tmp_DEP = cur_rec.data["DEP"];
Tmp_EMPLYID = cur_rec.data["EMPLYID"];
Tmp_LDMAN = cur_rec.data["LDMAN"];
Tmp_NWK = cur_rec.data["NWK"];
:
}
var sub2_Columns = [
{ header: "員工編號", dataIndex: "EMPLYID", width: 150, TMType: "string" },
{ header: "姓名", dataIndex: "EMPLYID_", width: 100, TMType: "string" },
{ header: "備註", dataIndex: "NOTE", width: 200, TMType: "string", },
{
header: '缺勤',
dataIndex: 'NWK',
xtype: 'checkcolumn',
width: 60,
editor: {
xtype: 'checkbox',
cls: 'x-grid-checkheader-editor',
inputValue: 'Y',
uncheckedValue: 'N'
},
//A renderer function used to return HTML markup for a cell given the cell's data value.
renderer: function (value, metadata, record, rowIndex, colIndex, store) {
var tempVal = '';
if ((value === 'Y') || (value === true)) { tempVal = 'checked'; }
var Tmp_Str = "<input type='checkbox' name=" + DatetoStr(record.get('DT')) + "_" + record.get('DEP') + "_" + record.get('EMPLYID') + " " + tempVal + " >";
return Tmp_Str;
},
}, // end of header='缺勤1'
];
Q2>如何在後端讀取 CheckBox欄位值
Ans:
string Tmp_NWK = nvc["Tmp_NWK"];
if ((Tmp_NWK=="true") || (Tmp_NWK == "Y"))
{ Tmp_NWK_VAL = "Y"; }
else
{ Tmp_NWK_VAL = "N"; }
2022年7月7日 星期四
Web改版 V120902 1>xls檔案未下載至前端Browser 2>TMGrid_高度設定_分頁控制Bar置於下方 3>主機下載檔案目錄權限設定
1>[列印點名表] – 檔案下載至前端 - standardSubmit: true, 且 必需以 form.submit, 不可用 Ext.Ajax
1>*.js
Ext.getCmp('mySubForm').submit({
url:
'../../api/V120902API/DoPRNLIST',
method: 'POST',
// 非 Ajax 的方式 //若要傳送檔案至前端, standardSubmit必需設為 true , 才會開新視窗,傳送 Binary檔案
//否則 Binary 檔案會放在原本的 Response
standardSubmit: true,
params:
np,
});
//顯示處理中..請稍待的訊息
var
mask = new Ext.LoadMask(Ext.getBody(), {
msg: '處理中,請稍待...'
});
mask.show();//使用 mask 需手動呼叫show() 方法下
var timer = setInterval(function () {
clearInterval(timer);
mask.hide();
timer = null;
var r = r_cookies('EX_DFile');
mysuccessalert(r);
},1000);
//1000ms = 3sec
}; // end of function mySub1_OkBtn_click()
2>[缺點現況維護]鈕 - TMGrid 的頁次未置於最下方 - Panel2 自動充滿畫面 - page
// [缺勤記錄維護] - 開啟子視窗, 所有的變數在 子視窗開啟時, 要重新宣告,
// --> 因為關閉子視窗時, 變數記憶體會被收回, 不重新宣告變數, 該變數會不存在
function RollEditBtn_click() {
var checkbox_id = 1;
//按鈕 : [確認] [取消] - [缺勤記錄維護]鈕
var mySub2_Btns = [
{
xtype: 'button', text: '確定', id:
'mySub2_OkBtn',
listeners: {
click: function () {
mysuccessalert("mysub2_確定 ");
mySub2_OkBtn_click();
}
}
},
];
var sub2_Columns = [
{ header: "員工編號", dataIndex:
"EMPLYID", width: 150, TMType: "string" },
{ header: "姓名", dataIndex:
"EMPLYID_", width: 100, TMType: "string" },
{ header: "缺勤", dataIndex:
"NWK", width: 50, TMType: "string" },
{ header: "備註", dataIndex:
"NOTE", width: 200, TMType: "string" },
{
header: '缺勤1',
dataIndex: 'NWK',
xtype: 'checkcolumn',
width: 60,
editor: {
xtype: 'checkbox',
cls:
'x-grid-checkheader-editor',
inputValue: 'Y',
uncheckedValue: 'N'
},
renderer: function (value,
metadata, record, rowIndex, colIndex, store) {
console.log("1
renderer value:", value);
var tempVal = '';
if ((value === 'Y') ||
(value === true)) { tempVal = 'checked'; }
var Tmp_Str =
"<input type='checkbox' name=" + DatetoStr(record.get('DT')) +
"_" + record.get('DEP') + "_" + record.get('EMPLYID') +
" " + tempVal + "
>";
console.log("1 renderer
return Tmp_Str:", Tmp_Str);
checkbox_id = checkbox_id +
1;
return Tmp_Str;
},
listeners: {
beforecheckchange: function
(me, rowIndex, checked, eOpts) {
mysuccessalert("2
befoercheckchange !!");
console.log("2
befoercheckchange checked 1:", checked);
if (checked) { checked
= false;checkVal = 'N'; }
else { checked = true;
checkVal = 'Y'; }
Ext.getCmp('sub2_Grid').store.getAt(rowIndex).set('NWK', checkVal);
console.log("2
befoercheckchange checked 2:", checked);
return true;
},
click: function () {
mysuccessalert("1 click event !!") },
//若 按 cellclick
checkchange: function (me,
rowIndex, checked, eOpts) {
mysuccessalert("3
checkchange !!");
console.log(" 3
checkchange checked :",
checked);
var checkVal = '';
if (checked) {
checkVal =
'Y';
console.log("3 checkchange 目前 checked= Y !! checkVal:", checkVal );
}
else {
checkVal = 'N';
console.log("
3 checkchange 目前 checked= N !! checkVal:", checkVal);
}
Ext.getCmp('sub2_Grid').store.getAt(rowIndex).set('NWK', checkVal);
console.log(" 4
checkchange Ext.getCmp(sub2_Grid).store.getat(rowIndex)",
Ext.getCmp('sub2_Grid').store.getAt(rowIndex));
}
}
},
];
// [缺勤記錄維護]鈕 - 子畫面欄位
var mySub2 = [
{
type:'panel', bodyStyle:
"background-color:transparent;", border: false, layout: { type:
'vbox', align: 'stretch' }, padding: "5",
items: [
{
xtype: 'panel',
id: 'sub2_panel1',
layout: { type: 'hbox',
align: 'stretch' },
flex: 5,
border: 1,
items: [
]
}, //end of panel1
{
xtype: 'panel',
id: 'sub2_panel2',
//title: 'sub2_panel2',
layout: { type: 'vbox',
align: 'stretch' },
//layout: 'fit',
flex: 10,
border: 1,
items: [
sub2_Grid ]
},
] // end of layout: "vbox", padding:
"5", items: [
}
//end of my_Sub2 , items[{
]
//end of my_Sub2 , items[
var win = getMyWindow("缺勤記錄維護", mySub2,
mySub2_Btns);
//Ext.getCmp('mySubForm').autoScroll =
true;
var Tmp_Sql = " SELECT EMPLYNM
"
+ " FROM
HR_EMPLYM "
+ " WHERE EMPLYID=" + AA(Ext.getCmp('sub2_LDMAN').getValue());
var Tmp_Str = SqlValue(Tmp_Sql);
Ext.getCmp('sub2_LDMAN_').setValue(Tmp_Str);
};
//console.log("2 win: ", win);
win.width = 700;
win.height = 400;
win.show();
//Runtime 設定 Panel2 : items[Sub2_Grid] 的高度, 以便充滿整個畫面
var Tmp_okpanel_Height =
Ext.getCmp('mySub2_OkBtn').getHeight()+20;
var Tmp_rHeight
=Ext.getCmp('mySubForm').getHeight()-Ext.getCmp('sub2_panel1').getHeight()-Tmp_okpanel_Height;
Ext.getCmp('sub2_panel2').setHeight(Tmp_rHeight);
};
2022年3月17日 星期四
V120703 - 匯入格式下載 - SS_FILES - V120103
V120703 - 匯入格式下載
目的: 提供使用者由資料庫下載匯入格式(SS_FILES. FNAME + FBODY)