填充复选框组

时间:2013-06-12 00:19:02

标签: database extjs checkboxlist populate

我需要从db填充一个checkboxgroup。 我有一个方法#populateObrasSociales(anArrayOfChkbox),这个方法的代码是:

populateObrasSociales: function(anArrayOfChkBox){
        var chkGrp = Ext.create('Ext.form.CheckboxGroup',{
            columns: 1,
            vertical: true,
            items: anArrayOfChkBox
        });
}

anArrayOfCheckBox是:

  

[ “{名称:IOMA,boxLabel:IOMA,inputValue的:1}”,   “{名称:OSPE,boxLabel:OSPE,inputValue的:2}”]

何时,显示FireBug表示的形式:

  

TypeError:无法将undefined转换为object

任何想法?谢谢!。

1 个答案:

答案 0 :(得分:1)

我猜你的复选框配置对象是字符串的事实没有帮助:

["{name:IOMA,boxLabel:IOMA,inputValue:1}", "{name:OSPE,boxLabel:OSPE,inputValue:2}"]

没有引号,它们就是对象:

[{name:IOMA,boxLabel:IOMA,inputValue:1}, {name:OSPE,boxLabel:OSPE,inputValue:2}]
相关问题