var radioGroup = {
xtype: 'radiogroup',
vertical: 'true',
columns: 1,
width: 200,
items: [{
boxLabel: 'Select Predefined interval',
name: 'timeInterval',
id: 'selectPredefinedInterval',
inputValue: 'predefined',
listeners: {
change: function(rf, newValue, oldValue) {
if (newValue) {
Ext.getCmp('predefinedDatePanel').show();
} else {
Ext.getCmp('predefinedDatePanel').hide();
}
}
}
},
{
boxLabel: 'Specify last X hours/days',
name: 'timeInterval',
id: 'SpecifyLastHours',
inputValue: 'lasthours',
listeners: {
change: function(rf, newValue, oldValue) {
if (newValue) {
Ext.getCmp('lastXDatePanel').show();
} else {
Ext.getCmp('lastXDatePanel').hide();
}
}
}
},
{
boxLabel: 'Specify date or interval',
name: 'timeInterval',
id: 'specifiedDate',
inputValue: 'specifydate',
listeners: {
change: function(rf, newValue, oldValue) {
if (newValue) {
Ext.getCmp('specifyDatePanel').show();
} else {
Ext.getCmp('specifyDatePanel').hide();
}
}
}
},
回答
请试着做这样的,它可能是你的工作..
var radioGroup = {
xtype: 'radiogroup',
vertical: 'true',
columns: 1,
width: 200,
items: [{
boxLabel: 'Select Predefined interval',
name: 'timeInterval',
id: 'selectPredefinedInterval',
inputValue: 'predefined'
},
{
boxLabel: 'Specify last X hours/days',
name: 'timeInterval',
id: 'SpecifyLastHours',
inputValue: 'lasthours',
},
{
boxLabel: 'Specify date or interval',
name: 'timeInterval',
id: 'specifiedDate',
inputValue: 'specifydate'
}
],
listeners: {
change: function(radio, newValue, oldValue) {
Ext.getCmp('predefinedDatePanel').hide();
Ext.getCmp('lastXDatePanel').hide();
Ext.getCmp('specifyDatePanel').hide();
if (radio.getValue().timeInterval == 'predefined' && newValue) {
Ext.getCmp('predefinedDatePanel').show();
} else if (radio.getValue().timeInterval == 'lasthours' && newValue) {
Ext.getCmp('lastXDatePanel').show();
} else if (radio.getValue().timeInterval == 'specifydate' && newValue) {
Ext.getCmp('specifyDatePanel').show();
}
}
}
},
其实, “& & NEWVALUE” 不需要...... 感谢.. :)
不适用于我,如果值为true,则不会调用所述面板 – user6454237
例如:if(true){Ext.getCmp('predefinedDatePanel')。show(); }应该调用这个面板,但它会去其他如果语句,而不是调用该面板 – user6454237
@ user6454237现在检查代码更新..我写错了“getValue”的拼写.. –
在ExtJs文档RadioGroup有更改事件。您可以参考ExtJs docs
我已经创建了一个小演示,以根据您的要求向您展示它是如何工作的。 Sencha fiddle example
Ext.create('Ext.form.Panel', {
title: 'RadioGroup Example',
width: '100%',
height: 500,
itemId: 'myPanel',
bodyPadding: 10,
renderTo: Ext.getBody(),
dockedItems: [{
xtype: 'toolbar',
defaults: {
hidden: true
},
items: [{
html: 'predefinedDatePanel',
itemId: 'predefined'
}, {
html: 'lastXDatePanel',
itemId: 'lasthours'
}, {
html: 'specifyDatePanel',
itemId: 'specifydate'
}]
}],
items: [, {
xtype: 'radiogroup',
vertical: 'true',
columns: 1,
width: 200,
listeners: {
change: function (rf, newValue, oldValue) {
var myPanel = rf.up('#myPanel');
myPanel.down('toolbar').items.items.map(item => {
item.hide();
})
myPanel.down(`#${newValue.timeInterval}`).show();
}
},
items: [{
boxLabel: 'Select Predefined interval',
name: 'timeInterval',
id: 'selectPredefinedInterval',
inputValue: 'predefined'
}, {
boxLabel: 'Specify last X hours/days',
name: 'timeInterval',
id: 'SpecifyLastHours',
inputValue: 'lasthours'
}, {
boxLabel: 'Specify date or interval',
name: 'timeInterval',
id: 'specifiedDate',
inputValue: 'specifydate'
}]
}]
});
- 1. 如何选择一个特定的领域,并显示它在MySQL
- 2. 如何在RichTextBox中选择单词时显示面板?
- 3. 如何显示上选择一个无线电特定的无线电输入框下拉菜单中的JavaScript
- 4. 在EXTJS中的标签面板单击监听器
- 5. 领域删除监听器
- 6. 如何使用一个jQuery选择一个特定的领域
- 7. 如何为ListView编写onClick监听器?
- 8. 如何在单个页面中显示2个定时器?
- 9. ExtJS的日期选择器监听
- 10. 如何通过事件监听器显示侧面菜单?
- 11. 在python选择特定领域
- 12. 如何在Polymer中的ES6中编写监听器?
- 13. 如何在选择特定的selectOneMenu选项时显示inputText?
- 14. 在电台选择显示特定值
- 15. 如何禁用无线电组中的多重选择extjs
- 16. 如何先显示一个特定的领域和MYSQL
- 17. 如何查询在特定领域
- 18. JavaFX8:如何在Tableview中为选择行创建监听器?
- 19. 如何选择特定的单选按钮来显示表单
- 20. 如何在C中编写监视器?
- 21. 如何突出显示面板网格上的特定区域
- 22. 如何在extjs中选择网格面板行作为HTMLELEMENT 4
- 23. 使用Tkinter时,如何在选择无线电选项时显示按钮,然后在不再选择无线电选项时消失?
- 24. 如何在ListView中显示选择器
- 25. 无线监听器
- 26. 如何在选择特定值时显示下拉框?
- 27. 如何在'选项'findall后选择表单的显示区域?
- 28. 选择监听器何时在视图中注册?
- 29. 如何从ExtJs中的单元格编辑插件中删除监听器?
- 30. EXTJS:如何在单个页面上显示多个网格?
请正确地格式化代码 – Derlin
目前我有听众每个无线领域,而不是如何利用单一听众 – user6454237
@ user6454237请做代码格式化第一。你的代码不可读。 – UDID