1. 程式人生 > >快速知曉Ext.form.RadioGroup獲取和設定 選項的值

快速知曉Ext.form.RadioGroup獲取和設定 選項的值

 1 Ext.widget('window', { 
 2         closeAction: 'close',
 3         closable: false,
 4         width: 800,
 5         height:300,
 6         layout: 'fit',
 7         resizable: true, 
 8         modal: true,
 9         layout: "column",
10         id: "PrcessSetWin",
11         items: [
12             new
Ext.form.FieldSet( 13 { 14 title : '工價顯示設定', 15 height: 70, 16 style: 'background-color:white;', 17 layout : 'column', 18 border: true, 19 columnWidth: 1, 20 margin:"20 20 0 20",
21 items: [ 22 new Ext.form.RadioGroup({ 23 columnWidth: 1, 24 id: "ProcessPrice", 25 margin:"10 10 10 10", 26 items: [ 27 { name: 'show', inputValue: '
0', boxLabel: '顯示', checked: true }, 28 { name: 'show', inputValue: '1', boxLabel: '不顯示', checked: false }, 29 { name: 'show', inputValue: '2', boxLabel: '工序複核後顯示', checked: false }, 30 { name: 'show', inputValue: '2', boxLabel: '工序審閱後顯示', checked: false } 31 ] 32 }) 33 ] 34 }), 35 new Ext.form.FieldSet( 36 { 37 title: '工序審閱設定', 38 height: 70, 39 style: 'background-color:white;', 40 layout: 'column', 41 border: true, 42 columnWidth: 1, 43 margin: "20 20 0 20", 44 items: [ 45 new Ext.form.RadioGroup({ 46 id: "ProcessAudit", 47 columnWidth: 1, 48 margin: "10 10 10 10", 49 items: [ 50 { name: 'shenyue', inputValue: '0', boxLabel: '審閱後可更改', checked: true }, 51 { name: 'shenyue', inputValue: '1', boxLabel: '審閱後不可更改', checked: false } 52 ] 53 }) 54 ] 55 56 }) 57 ], 58 tbar: [{ xtype: "tbfill" }, { 59 xtype: "button", 60 style: window.parent.SYSBTNBGCOLOR, 61 margin: "0 0 0 10", 62 text: "保 存", 63 handler: function () { 64 65 } 66 }, { xtype: "tbfill" }], 67 defaultFocus: 'firstName', 68 maximizable: true, 69 tools: [ 70 { 71 type: 'close', 72 qtip: '關閉視窗', 73 handler: function (event, toolEl, panel) { 74 Ext.getCmp("PrcessSetWin").destroy(); 75 } 76 } 77 ] 78 79 }).show();

執行效果如下:

獲取 單選框的值: Ext.getCmp('ProcessPrice').getChecked()[0].boxLabel    得到的就是當前選中的 "顯示" 值.

賦值:

 

Ext.getCmp('ProcessPrice').setValue({RadioGroupName:Value});  //注意此處賦值必須給一個物件引數 

Ext.getCmp('ProcessPrice').setValue({'show':1});  //注意此處賦值必須給一個物件引數