2022年8月28日 星期日

V120402 - Radiobox 處理 - 取得 radioGroup 欄位值

 目的:  在畫面上顯示 Radiobox

處理說明: 1> {xtype: 'radiogroup', fieldLabel: '現況', labelWidth: 40, layout: 'vbox', 
                                id: 's_STAT',

                                items: [
                                    {
                                        boxLabel: '全部(不含已刪除)',
                                        name: 's_STAT',

                                        inputValue: 'ALL',                                        
                                        width: 200,
                                        checked: true,                                        
                                    }, {
                                        boxLabel: ' 可借閱',
                                        name: 's_STAT',

                                        inputValue: 'A',    
                                        //width: 200,
                                    }, {  :



1>*.js
 {
    xtype: 'radiogroup', fieldLabel: '現況', labelWidth: 40, layout: 'vbox', 
    id: 's_STAT',
    items: [
                                    {
                                        boxLabel: '全部(不含已刪除)',
                                        name: 's_STAT',
                                        inputValue: 'ALL',                                        
                                        width: 200,
                                        checked: true,                                        
                                    }, {
                                        boxLabel: ' 可借閱',
                                        name: 's_STAT',

                                        inputValue: 'A',    
                                    }, {
                                        boxLabel: '已借出',
                                        name: 's_STAT',
                                        inputValue: 'B',    
                                    },
                                    {
                                        boxLabel: '已刪除',
                                        name: 's_STAT',
                                        inputValue: 'Z',                                            
                                    }



//顯示資料
  {
                //xtype: 'toolbar',
                xtype: 'panel',
                id: 'panel2',
                layout: { type: 'vbox', align: 'right' },
                flex: 1,
                border: 0,
                items: [
                    {
                        xtype: 'button',
                        id: 'btn_Show',
                        flex: 2,
                        border: 1,
                        text: '資料顯示',
                        iconCls: 'icon-search',
                        handler: function () {
                           var np = s_JSON('s_form'); //TMFunction.js, 組合form上的查詢條件為json參數傳遞
                            np["s_STAT"] = Ext.getCmp('s_STAT').getValue();

                            gridstore.getProxy().url = '../api/V120402API/getGridData_M';
                            gridstore.getProxy().extraParams = np; //分頁OK,篩選條件OK

                            Ext.getCmp('grid_M').reloadGridData();                            
                        }
                    },  // end of 顯示資料
                    {
                        xtype: 'button',
                        id: 'btn_clear',
                        flex: 2,
                        border: 1,
                        text: '清除條件',
                        iconCls: 'icon-clear',
                        handler: function () {
                            var f = Query.getForm();
                            f.reset();
                        }
                    },  // end of 清除條件                    
                    { xtype: 'label', id: 'label151', flex: 2, border: 0, text: '', },  // end of label
                    { xtype: 'label', id: 'label152', flex: 2, border: 0, text: '', },  // end of label                    
                ]  // end of items of [顯示資料][清除條件]
            }   // end of panel2
        ]  // end of  items of Query


2>V20107.js  - 下載匯入格式  - 出現子視窗 - 勾選下載類別
//[下載匯入格式]鈕 - 子視窗    
    function downloadBtn_click() {
        console.log("step1");
        //按鈕 : [確認] [取消]  - [借閱登記]鈕
        var sub_downloadFlds_Btns = [
            {
                xtype: 'button', text: '確定', id: 'sub_downloadFlds_OkBtn',
                listeners: {
                    click: function () {
                        //mysuccessalert("mysub2_確定 ");
                        sub_downloadFlds_OkBtn();
                    }
                }
            },            
            {
                xtype: 'button', text: '取消', id: 'sub_downloadFlds_CancelBtn',
                listeners: {
                    click: function () {
                        //mysuccessalert("mysub2_取消");
                        var Tmp_win = this.up("window");
                        if (Tmp_win == undefined) {
                            Ext.Msg.alert("取消時未取到Window Object");
                        }
                        this.up("window").close();
                        this.up("window").destroy();
                    }
                }
            },
        ];

        console.log("step2");

        // [下載匯入格式]鈕  - 子畫面欄位
        var sub_downloadFlds = [
            {
                type: 'panel', bodyStyle: "background-color:transparent;", border: 0, padding: "5",                
                layout: { type: 'vbox', align: 'stretch' }, 
                //layout: 'border',
                items: [                    
                            {
                                xtype: 'radiogroup', fieldLabel: '選擇匯入格式', labelWidth: 100, layout: 'vbox',
                                id: 'sub_MAIN_SUB',
                                items: [
                                    {
                                        boxLabel: 'V20107_主檔匯入格式 ',
                                        name: 'sub_MAIN_SUB',
                                        inputValue: 'MAIN',
                                        width: 200,
                                        flex: 50,
                                        checked: true,
                                    }, {
                                        boxLabel: ' V20107_子步序匯入格式 ',
                                        name: 'sub_MAIN_SUB',
                                        inputValue: 'SUB',
                                        flex: 50,
                                        //width: 200,
                                    }, 
                                ]
                            }, //end of sub2_panel11 , flex:20                               
                ] // end of   layout: "vbox", padding: "5", items: [
            }  //end of   sub_downloadFlds , [{}
        ]      //end of  sub_downloadFlds , [        

        var win = getMyWindow("選擇要下載的匯入格式", sub_downloadFlds, sub_downloadFlds_Btns);
        win.setWidth(350);
        win.setHeight(200);
        win.show();                
    } // end of   function downloadBtn_click() {

    //下載匯入格式
    function sub_downloadFlds_OkBtn() {
        var Tmp_MAIN_SUB; 
        //radioGroup取得欄位值為 Object  需 Object.["sub_MAIN_SUB"] 才是字串
        Tmp_MAIN_SUB = Ext.getCmp('sub_MAIN_SUB').getValue();   
        console.log("Tmp_MAIN_SUB:", Tmp_MAIN_SUB);
        var Tmp_FName=""
        if (Tmp_MAIN_SUB["sub_MAIN_SUB"] == "MAIN")
        //if (Tmp_MAIN_SUB == "MAIN")
            Tmp_FName = "V20107_主檔匯入格式.xlsx"
        else 
            Tmp_FName = "V20107_子步序匯入格式.xlsx"
        console.log("Tmp_FName:", Tmp_FName);
        document.location = "../api/VUTLAPI/dnloadSS_File?FNAME="+Tmp_FName;           
    };

沒有留言:

張貼留言