作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在作为表单面板一部分的复选框组中获取所有选中的项目。最终它们将作为字符串、逗号分隔值格式保存回数据库。
感谢您提供的任何指导或帮助。
这是我定义组的方式:
new Ext.form.CheckboxGroup({
id: 'newId',
fieldLabel: 'Group A',
name: 'broker',
allowBlank: false,
columns: 1,
items: [{
boxLabel: 'All',
name: 'all',
id: 'null'
},
{
boxLabel: 'FS',
name: 'fs',
id: '1'
},
{
boxLabel: 'Royal A',
name: 'ra',
id: '2'
},
{
boxLabel: 'Point',
name: 'sp',
id: '6'
}]
})
最佳答案
使用CheckBoxGroup
的getValue()
方法。来自API docs :
getValue():
Gets an array of the selected Ext.form.Checkbox in the group.
Returns: An array of the selected checkboxes.
然后您可以对返回的数组调用 join(",")
以获取逗号分隔的列表。
关于javascript - ExtJS - 遍历 CheckBoxGroup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4379056/
我是一名优秀的程序员,十分优秀!