Jacobian
Jacobian

Reputation: 10872

How to bind fieldset value

For some strange reason I'm unable to bind value for a fieldset with checkboxToggle property set to true. So, its config looks like so:

xtype: "fieldset",
title: "Box",
checkboxName: "bounding_box",            
checkboxToggle: true,
bind: {
    collapsed: "{!rec.bounding_box}"
} // results in error message: TypeError: this[c._config.names.set] is not a function
// bind: "{!rec.bounding_box}" does not work either

So, the code above does not work. However, the very same technique works great with simple checkbox field:

xtype: "checkbox",
fieldLabel: "Show label",                
name: "show_label",
bind: "{rec.show_label}"

What is wrong with that and how can I fix it?

Upvotes: 1

Views: 1020

Answers (1)

Evan Trimboli
Evan Trimboli

Reputation: 30092

If you're running in a debug build you'll get an error message saying that it can't bind because there is no setCollapsed method on fieldset. You can add it pretty easily:

Ext.define('AddSetCollapsed', {
    override: 'Ext.form.FieldSet',

    setCollapsed: function(collapsed) {
        if (collapsed) { 
            this.collapse();
        } else {
            this.expand();
        }
    }
});

Upvotes: 5

Related Questions