0
我有一個包含2個radiogroups的面板。我正嘗試將更改事件綁定到來自控制器文件的這些項目。不想在視圖文件中使用監聽器配置。如何在Ext Js 4中從控制器引用多個radiogroup?
在查看文件
items : [{
xtype:'radiogroup',
fieldLabel: 'Two Columns',
// Arrange radio buttons into two columns, distributed vertically
columns: 2,
id:'new_0',
vertical: true,
items: [
{ boxLabel: 'Item 1', name: 'rb1', inputValue: '1' },
{ boxLabel: 'Item 2', name: 'rb1', inputValue: '2', checked: true},
{ boxLabel: 'Item 3', name: 'rb1', inputValue: '3' },
{ boxLabel: 'Item 4', name: 'rb1', inputValue: '4' },
{ boxLabel: 'Item 5', name: 'rb1', inputValue: '5' },
{ boxLabel: 'Item 6', name: 'rb1', inputValue: '6' }
]
},
{
xtype:'radiogroup',
fieldLabel: 'Two Columns',
id:'new_1',
// Arrange radio buttons into two columns, distributed vertically
columns: 2,
vertical: true,
items: [
{ boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
{ boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true},
{ boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
{ boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
{ boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
{ boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
]
}],
和Controller我想如下的變化綁定事件:
refs : [
{
ref :'myradio',
selector:'radiogroup'
}],
這裏它指向第一個項目,不具約束力的第二個事件RadioGroup中。如果我綁定IDS它的工作正常。所以問題是我如何將更改事件綁定到所有的radiogroup,而無需在選擇器中傳遞id。讓我們說,在一個panle中,我有2個radiogroup項目,並希望將更改事件綁定到每個radiogroup。
由於一噸提前爲您解答!!!!
這很好,但是我們如何爲所有的radiogroup綁定相同的事件。比方說,我們必須爲每個radiogroup調用相同的函數,所以我們不必爲每個radiogroup重寫相同的函數名稱,而是可以引用所有的radiogroups,並在函數內部由id來決定? – aswininayak 2013-04-30 10:11:42