react-dual-listbox
react-dual-listbox copied to clipboard
Is it possible to load async options?
Hello @jakezatecky,
I am needing to load async options from a remote source as the user types. Is it possible to do with this component?
When you say "as the user types" are you referring to the filter input? Currently, there is no built-in mechanism for asynchronous load, as the component uses the same set of options
for both list boxes and filterCallback
is iterated through the already available options.
I definitely see value in having support for asynchronous loading of options based on user input. I am thinking it might make sense to have a property like asyncOptions
where it is called in whenever the available filter changes and that it should return a list of options.
This would supersede the existing options
property and likely would require that the selected
property be an array of { label, value }
options instead of just strings. I might follow the route of react-select
and just create a separate component to import, AsyncDualListBox
to enforce that requirement.
Thank you for the reply!
Yes, I am referring to the filter input. I know the async component of react-select. It's the same idea, but I want a dual list instead of a select. I would appreciate that feature in your lib.
An example of asynchronous loading of options
using the onFilterChange
callback is now present in the v6.0-dev
branch.