2
votes

I have a FormPanel with a tree of checkboxes wich are added on creation. Now i want to change the general name pattern of all checkboxes inside the panel. According to the DOM the names are changed correctly but when i submit the form still the old names are submitted. Tried calling .doLayout but without any luck. Any ideas?

changePredicateName: function (panel, predicateName) {
    var ref = this;
    this.counter = 0;
    panel.cascade(function (o) {
        var name = ref.groupId + "." + predicateName + "." + ref.counter + "_value";
        if (o instanceofnExt.form.Checkbox) {
            o.name = name;
            ref.counter++;
        } else if (o.titleCheckbox) {
            o.titleCheckbox.name = name;
            ref.counter++;
        }
        return true;
    });
    panel.doLayout();
},
1

1 Answers

0
votes

doLayout only resizes / rearranges objects; it does not change properties such as the name of an element. In order to change the names of the elements you've created, you'll need to do some DOM manipulation like the following (Assuming o is an Ext.Element):

if (o instanceofnExt.form.Checkbox) {
    o.name = name;
    o.set({ name: name });
    ref.counter++;
} else if (o.titleCheckbox) {
    o.titleCheckbox.name = name;
    o.titleCheckbox.set({ name: name });
    ref.counter++;
}