我有一个checkboxgroup和一个radiogroup.对于他们两个,我想要抓住几个值.对于checkboxGroup
var DescCheck = new Ext.form.CheckboxGroup({
fieldLabel: 'Description of service : <span style="color: rgb(255, 0, 0); padding-left: 2px;">*</span>',
width : 540,
labelSeparator : '',
items: [
{boxLabel: 'Direct', name: 'Direct', inputValue: 'Direct'},
{boxLabel: 'Fixed-day', name: 'day', inputValue: 'Fixed'},
{boxLabel: 'Weekly', name: 'Weekly', inputValue: 'Weekly'}
]
});
Run Code Online (Sandbox Code Playgroud)
我试过DescCheck.getValue()但它还给了我
[对象]
我试过了DescCheck.getValue().inputValue,它什么也没归我.
对于radioGroup
var TypeCheck = new Ext.form.RadioGroup({
items: [
{boxLabel: 'New 1', name: '1', inputValue: '1'},
{boxLabel: 'New 2', name: '2', inputValue: '2'},
{boxLabel: 'New 3', name: '3', inputValue: '3'}
]
Run Code Online (Sandbox Code Playgroud)
我试过TypeCheck.getValue().inputValue但它只返回了第一个选中的项目.我怎样才能抓住几个复选框?
您是否尝试过getChecked以获取所有复选框.
DescCheck.getChecked();
Run Code Online (Sandbox Code Playgroud)
更新
您应该使用getValue(),它返回所选值的数组.
你可以通过像这样循环遍历数组来实现
var selectedValue = DescCheck.getValue();
for(var i=0;i<selectedValue.length;i++){
console.log(select[i].inputValue);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8788 次 |
| 最近记录: |