Can't load options with Select.Async -
i can't basic application async options loading work. getoptions
function gets called select control doesn't display them. here's code , plunkr link https://plnkr.co/edit/vkzxhjqrhdwflmqpt8b5?p=preview
var options = [ { value: 'one', label: 'one' }, { value: 'two', label: 'two' } ]; function logchange(val) { console.log("selected: " + json.stringify(val)); } function getoptions(input) { console.log(input) return promise.resolve(options) } reactdom.render( <select.async name="form-field-name" value="one" loadoptions={getoptions} onchange={logchange} />, document.getelementbyid('example') );
i believe need return { options: yourdataarray } instead of yourdataarray.
for example, in code, return promise.resolve(options)
should changed return promise.resolve({options})
hope helps.
Comments
Post a Comment