powmedia / backbone-forms

Form framework for BackboneJS with nested forms, editable lists and validation
MIT License
2.17k stars 415 forks source link

setOptions not working in select editor when function is used. #551

Open stephenjgray opened 5 years ago

stephenjgray commented 5 years ago

I am using the following schema for a radio control:

    radio: {
        type: 'Radio',
        title: 'Title'
        options: function() {
            return [
                { label: 'radio 1', val: 'value1' },
                { label: 'radio2, val: 'value2'}
            ]
        }
    }

The code seems to get as far as the else if (_.isFunction(options)) block but does not make it into the renderOptions function. I have over-ridden the function in my code and replaced the block with:

    else if (_.isFunction(options)) {
        var newOptions = options();

        this.renderOptions(newOptions);
    }