extjs中怎样设置radiogroup的默认值
答案:2 悬赏:0
解决时间 2021-03-17 04:58
- 提问者网友:若相守£卟离
- 2021-03-16 20:53
extjs中怎样设置radiogroup的默认值
最佳答案
- 二级知识专家网友:哥在撩妹请勿打扰
- 2021-03-16 21:20
extjs的combox设置默认选中第一行确实是一件痛苦的事情。。。
我自己是这样做的
var store = ext.create('ext.data.store', {
fields: ['键值']
proxy: {
type: 'ajax',
url: 'xxx.php',
reader: {type: 'json'}
}
});
combobox = ext.create('ext.form.combobox', {
store: store,
//参数
});
//监听load事件
store.on('load', function(){
combobox.select(store.getat(0));
});
监听事件写到ext.onready(function(){});中
我自己是这样做的
var store = ext.create('ext.data.store', {
fields: ['键值']
proxy: {
type: 'ajax',
url: 'xxx.php',
reader: {type: 'json'}
}
});
combobox = ext.create('ext.form.combobox', {
store: store,
//参数
});
//监听load事件
store.on('load', function(){
combobox.select(store.getat(0));
});
监听事件写到ext.onready(function(){});中
全部回答
- 1楼网友:情窦初殇
- 2021-03-16 21:51
如果生成时把默认值对应的checked设为ture,
如果已经生成要改大致这样写form.down("name[value='缺省值']).checked=true
例子:
Ext.create('Ext.form.Panel', {
title: 'RadioGroup Example',
width: 300,
height: 125,
bodyPadding: 10,
renderTo: Ext.getBody(),
items:[{
xtype: 'radiogroup',
fieldLabel: 'Two Columns',
// 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' }
]
}]
});
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯