当默认类型为按钮时,如何获取toggleGroup的值。 allowblank:false也不起作用。
{
xtype:'radiogroup',
fieldLabel: 'What is your title?',
layout:'hbox',
allowBlank:false,
defaultType: 'button',
id: 'titleSel',
defaults: {
enableToggle: true,
toggleGroup: 'titleGroup',
allowDepress: false,
width: '16.56%',
name: 'title',
},
items: [
{text: 'Mr', value: 'Mr', inputValue: 'sfsf'},
{text: 'Mrs', value: 'Mrs'},
{text: 'Madam', value: 'Madam'},
{text: 'Ms', value: 'Ms'},
{text: 'Dr', value: 'Dr'},
{text: 'Prof', value: 'Prof'},
],
},
答案 0 :(得分:0)
...你必须扩展类Ext.container.ButtonGroup
,然后将按钮的默认处理程序绑定到自定义更改事件侦听器...它将获得传递的名称或ID。 / p>
Ext.define('SomeApp.view.toggle.Titles', {
extend: 'Ext.container.ButtonGroup',
alias: ['widget.ToggleTitles'],
frameHeader: true,
title: false,
columns: 6,
width: 300,
height: 46,
border: 0,
defaults: {
enableToggle: true,
toggleGroup: 'titles',
handler: function(){
this.up('buttongroup').fireEvent('change', this.name.replace('btn', '').toLowerCase());
}
},
items: [
{tabIndex: 1, name: 'btnMr', text: 'Mr', pressed: true},
{tabIndex: 2, name: 'btnMrs', text: 'Mrs'},
{tabIndex: 3, name: 'btnMadam', text: 'Madam'},
{tabIndex: 4, name: 'btnMs', text: 'Ms'},
{tabIndex: 5, name: 'btnDr', text: 'Dr'},
{tabIndex: 6, name: 'btnProf', text: 'Prof'}
],
listeners: {
change: function(value){
...
}
}
}