Я пытаюсь заполнить форму флажками, используя объект JavaScript и Ext.data.Model.С формой textField следующий код работает нормально:
// text is an array with text values
var currentForm = {
"name_value1": text[0],
"name_value2": text[1],
};
Ext.define('CurrentFormModel', {
extend: 'Ext.data.Model',
fields: ['name_value1',
'name_value2',
]
});
var Get_textFieldForm = textFieldForm.getForm();
Get_textFieldForm.loadRecord(new CurrentFormModel(currentForm));
Как мне добиться этого с формой флажка?Я попробовал следующее:
// text[2][i] is an array with the checked values
var checkFormObj = {
"checkboxGroupName": [text[2][0], text[2][1]]
}
Ext.define('CheckboxModel', {
extend: 'Ext.data.Model',
fields: [{name: 'checkboxGroupName', type: 'boolean'}]
});
var Get_CheckboxForm = CheckboxForm_name.getForm();
Get_CheckboxForm.loadRecord(new CheckboxModel(checkFormObj));
Моя форма флажка:
CheckboxForm_name = Ext.create('Ext.form.Panel', {
title: 'Checkbox form',
collapsible: true,
collapsed: true,
items: [{
xtype: 'checkboxfield',
name: 'checkboxGroupName',
boxLabel: 'Checkbox1',
inputValue: 'checkbox_1'
}, {
xtype: 'checkboxfield',
name: 'checkboxGroupName',
boxLabel: 'Checkbox2',
inputValue: 'checkbox_2'
}]
});
Но ничего не происходит.Есть идеи?