javascript - 在 extjs 4 中加载期间取消选中整体 radio 组 radio 场

标签 javascript jquery html extjs extjs4

这里单选组中的单选字段通常是根据之前的选择来选择的。即,刷新页面时它会自动设置以前的值。但我需要清除单选组中的所有值。

this.mcmAdminServiceIndicatorsRadioGroup = new Ext.form.RadioGroup({
            width: 350,
            height: 50,
            items: [
                {
                    xtype: 'radiofield',
                    name: 'serviceIndicator',
                    fieldLabel: '',
                    inputValue: 'ADM',
                    boxLabel: 'ADM'
                },
                {
                    xtype: 'radiofield',
                    name: 'serviceIndicator',
                    margin: '0 0 0 20',
                    fieldLabel: '',
                    inputValue: 'BCK',
                    boxLabel: 'BCK'
                },
                {
                    xtype: 'radiofield',
                    name: 'serviceIndicator',
                    margin: '0 0 0 20',
                    fieldLabel: '',
                    inputValue: 'CKC',
                    boxLabel: 'CKC'
                },
                {
                    xtype: 'radiofield',
                    name: 'serviceIndicator',
                    margin: '0 0 0 20',
                    fieldLabel: '',
                    inputValue: 'BRK',
                    boxLabel: 'BRK'
                },
                {
                    xtype: 'radiofield',
                    name: 'serviceIndicator',
                    margin: '0 0 0 20',
                    fieldLabel: '',
                    inputValue: 'FMF',
                    boxLabel: 'FMF'
                }               
            ]
        });

我在另一个 radio 组组件的监听器中尝试了这三种方法..

this.mcmTaskCategoryRadiogroup = new Ext.form.RadioGroup({
            width: 205, 
            height: 50,
            items: [
                { 
                    xtype: 'radiofield', 
                    name: 'type', 
                    inputValue: 'Customer',
                    boxLabel: 'Customer', 
                    checked: true 
                },
                { 
                    xtype: 'radiofield', 
                    name: 'type', 
                    inputValue: 'Admin',
                    boxLabel: 'Admin' 
                }
            ],
            listeners: {
                scope: this, 
                change: function(radiogroup, newValue, oldValue) { //will be trigger twice, one with both fields, and second with the new field

                    if(typeof(newValue.type) == 'string') {
                        if(newValue.type === 'Admin') {
                            this.mcmPassengerFieldSet.hide();
                            this.mcmPassengerServiceIndicatorsFieldSet.hide();
                            this.mcmAdminServiceIndicatorsFieldSet.show();
                            this.mcmRequestTypeCombobox.store.loadData([{ name: 'Admin' }], false);
                            this.mcmRequestTypeCombobox.setValue('Admin');
                            //this.mcmAdminServiceIndicatorsRadioGroup.setValue(false);


//this.mcmAdminServiceIndicatorsRadioGroup.setValue({ serviceIndicator: taskType });


this.mcmAdminServiceIndicatorsRadioGroup.items.items[0].setValue(true);
                        } else if(newValue.type === 'Customer') {
                            this.mcmPassengerFieldSet.show();
                            this.mcmPassengerServiceIndicatorsFieldSet.show();
                            this.mcmAdminServiceIndicatorsFieldSet.hide();
                            this.mcmRequestTypeCombobox.store.loadData([
                                { name: '5Star' }, 
                                { name: '5Key' },
                                { name: 'Concierge Key' }, 
                                { name: 'Focus Market' }, 
                                { name: 'Sales' }, 
                                { name: 'OA VIP' },
                                // TCS:09-24-2013 modified
                                { name: 'JL VIP' },
                                { name: 'BA VIP' },
                                { name: 'IB VIP' },
                                { name: 'QF VIP' },
                                // modification ended
                                { name: 'Other'  } 
                            ], false);
                            this.mcmRequestTypeCombobox.setValue(
                                this.mcmDisplayedRecord.get('RequestType') ? this.mcmDisplayedRecord.get('RequestType') : 'Other');
                        }
                    }
                }
            }
        });

最佳答案

您是否尝试过从客户单选字段中删除“checked : true”?

大卫

关于javascript - 在 extjs 4 中加载期间取消选中整体 radio 组 radio 场,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21331572/

相关文章:

javascript - 遍历 DOM 中的属性

jquery - 在等待 getJSON 时显示加载 gif

java - 从 HTML 文件中收集数据

javascript - 如何找出哪些 JavaScript 引擎/平台支持 ES6 Unicode 正则表达式的哪些功能?

javascript - 循环运行一个函数直到

javascript - 如何将2个数组复制到1个数组中?

javascript - 使用 jquery 将文本更改为 h1?

html - 在没有滚动条的情况下一个接一个地显示两个 div 的问题

javascript - varien/configurable.js Magento 中无法访问的代码

jquery - 如何在@Url.Action中传递动态值?