gpt4 book ai didi

javascript - ExtJS - 遍历 CheckBoxGroup

转载 作者:行者123 更新时间:2023-11-29 09:59:31 24 4
gpt4 key购买 nike

我想在作为表单面板一部分的复选框组中获取所有选中的项目。最终它们将作为字符串、逗号分隔值格式保存回数据库。

感谢您提供的任何指导或帮助。

这是我定义组的方式:

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'
}]
})

最佳答案

使用CheckBoxGroupgetValue() 方法。来自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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com