automat/controlkit.js

Select component defaults to 'Choose ...' when selected option is 0

Opened this issue · 0 comments

Consider the example:

var obj = {
    select : ['Hello','you','may','choose','one','of','these','options']
};
var controlKit = new ControlKit();
controlKit.addPanel().addSelect(obj,'select',{
    selected : 2,
    onChange : function(index){
        console.log(index);
    }
});

This renders the component with the correct option 'may' pre-selected.

However, updating the selected property to:

    selected: 0

Results in the component being rendered with the default 'Choose ...' option.