顯示具有 Ext.Msg 標籤的文章。 顯示所有文章
顯示具有 Ext.Msg 標籤的文章。 顯示所有文章

2023年6月20日 星期二

V120202E – 確定後,才繼續往下執行 – Ext.Msg.alert –Ext.Msg.confirm - [退庫歸儲]鈕 , 詢問

 目的: V120202E 確定後,才繼續往下執行 – Ext.Msg.alert –Ext.Msg.confirm  - [退庫歸儲]鈕

處理說明: 1> Ext.Msg.confirm('是&否', me.delMessage, yes2go);
                        function 
yes2go(id) 
                        { if (id == 'yes') { }}
                 2> Ext.Msg.alert('確定', me.delMessage, ok2go);
                        function 
ok2go(id) 
                        { if (id == 'ok') { }}




1>*.js
- Ext.Msg.alert  - ok
             Tmp_Str = Tmp_Str
                    + "申請單號(" + cur_rec.data["APNO"].toString() + ") <br> "
                    + "退庫歸儲完成!!<br>";
                Ext.Msg.alert('確認', Tmp_Str, ok2go);
                function ok2go(id) {          
                    console.log("id:", id);
                    if (id == 'ok') {
                        //mysuccessalert("退庫歸儲完成 !!");
                        //清空 [點料人員][退庫原因] & grid 資料
                        Ext.getCmp("sub_BKMG").setValue("");
                        Ext.getCmp("sub_APNO").setValue("");
                        Ext.getCmp("sub_CAUSE_REMARK").setValue("");
                        var Tmp_gridstore = Ext.getCmp("sub_Grid").store;
                        Tmp_gridstore.clearData();
                        Tmp_gridstore.removeAll();
                    }// end of if(id=='yes')
                } //end of callbackfunc
            }


-Ext.Msg.confirm - Yes & No
            me.delMessage = "確定刪除勾選的資料嗎?";
            Ext.Msg.confirm('提醒', me.delMessage, callBackFunc);
            function callBackFunc(id) {
                if (id == 'yes') {
                    console.log("cur_recs.length:", cur_recs.length);
                    var gridstore = Ext.getCmp('grid_Single').store;                        
                    for (let i = 0; i <= cur_recs.length - 1; i++) {
                        console.log("i:", i);                        
                        Ext.getCmp('grid_Single').getSelectionModel().select(cur_recs[i]); //grid select指向所選的資料
                        cur_rec = Ext.getCmp('grid_Single').getSelectionModel().getSelection();
                        console.log("cur_rec: ", cur_rec);                        
                        if (Ext.getCmp('btn_del').afterDel() == false) {
                            return;
                        }                                                
                    } //  end of for (let i=0,)
                    //資料庫均刪除完成後, 才由 gridstore 移除資料
                    for (let i = 0; i <= cur_recs.length - 1; i++) {
                        gridstore.remove(cur_recs[i]); //畫面上隱藏刪除列                     
                    } //  end of for (let i=0,)
                    Ext.getCmp('grid_Single').getView().refresh();
                    buttonModel.modelType = 0;
                }  // end    if (id == 'yes')             
            }  // end of callbackfunc