Search code examples
extjsextjs3

ExtJS 3.4 checkboxgroup doesn't set value


I get checked data string: "box0,box15,box30,box45"

Sencha docs says, I can set the value this way (checkboxes id and name are same like above)

// use comma separated string to set items with name to true (checked)
myCheckboxGroup.setValue('cb-col-1,cb-col-3');

I want to set true my boxes this way, but can't. Have you any idea about this?


Solution

  • This should work :

    Ext.getCmp('MyCheckboxGroup').setValue({
         cbxName: true,
         cbxDescription: false
         //cbxDescription: (condition)  //you can always specify an condition here.
     });
    

    NOTE: cbxName, cbxDescription are the id's of checkboxes under MyCheckboxGroup, eg:

    {
        xtype: 'checkboxgroup',
        fieldLabel: 'MyCheckboxGroup',
        name: 'mycbxgrp',
        columns: 2,
        items: [
            { id: 'cbxName', boxLabel: 'Name', name: 'mycbxgrp', inputValue: 1 },
            { id: 'cbxDescription', boxLabel: 'Description', name: 'mycbxgrp', inputValue: 2 }
        ]
    }