Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs Ext JS-在默认类型为button时获取toggleGroup的值_Extjs - Fatal编程技术网

Extjs Ext JS-在默认类型为button时获取toggleGroup的值

Extjs Ext JS-在默认类型为button时获取toggleGroup的值,extjs,Extjs,当默认类型为button时,如何获取toggleGroup的值。 allowblank:false也不起作用 { xtype:'radiogroup', fieldLabel: 'What is your title?', layout:'hbox', allowBlank:false, defaultType: 'button', id: 'titleSel', def

当默认类型为button时,如何获取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'},          
            ],
        },

在ExtJS5.x中。。。您必须扩展class
Ext.container.ButtonGroup
,然后将按钮的默认处理程序绑定到自定义更改事件侦听器。。。获取传递的名称或id

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){
           ...
        }
    }

}

您在RadioGroup上尝试过getChecked()吗?getChecked()没有返回任何值。当我删除-defaultType:“button”时,我能够在submit按钮上获得值。基本上,我试图将单选的外观更改为button.Ext.getCmp('titleSel').getChecked()--不返回任何值。Ext.getCmp('titleSel')。getValue()将值返回为[object object object]是否真的要求您的组使用按钮?这不是返回任何值,因为按钮不是formFields,这意味着它不会在formSubmit上返回任何值