What value to return or function to be invoked when the loadOptions doesn't return any data. Right now it shows "Type to search".
Example I got the the function below:
getOptions(input, callback) {
var select2options = {
options: [],
}
Actions.getDevelopers(input,function(err, options){
if (err) {
// throw an error here
}
if (options) {
// loop through
_.forEach(options.data, function(option){
select2options.options.push({
value: option._id,
label: option.name
});
})
select2options.complete = true;
// call the callback
callback(null,select2options);
}
// no result found what to do here to invoke "No result found"?
});
}
I have the same issue and I used below code, but it shows type to search.
callback(null, {
options : [],
});
Same problem for me. I've just cloned repo to my local and tested examples. It works slightly different to online version - No results found message on Github users select never appears, I always seeing Type to search message instead.
I had the same issue. Made it working with explicitly setting noResultsText prop. I am returning empty array from loadOptions callback when zero results found though, not null. Haven't tested with null.
I had the same issue. Made it working with explicitly setting
noResultsTextprop. I am returning empty array fromloadOptionscallback when zero results found though, not null. Haven't tested with null.
worked for me :+1:
Hello -
In an effort to sustain the react-select project going forward, we're closing old issues.
We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest version.
If you aren't using the latest version of react-select please consider upgrading to see if it resolves any issues you're having.
However, if you feel this issue is still relevant and you'd like us to review it - please leave a comment and we'll do our best to get back to you!
Most helpful comment
I had the same issue. Made it working with explicitly setting
noResultsTextprop. I am returning empty array fromloadOptionscallback when zero results found though, not null. Haven't tested with null.