AsyncChoices
Sourceimport { AsyncChoices } from "@prestojs/viewmodel";
Default implementation for AsyncChoicesInterface
All options can be customised via options.
You must provide list and retrieve - everything else can be optional with the following restrictions:
getLabel- this is optional if items returned bylistandretrieveimplement NodeLabeled otherwise it must be providedgetValue- this is optional if items returned bylistandretrieveimplement Identifiable otherwise it must be provided
API
Constructor
new AsyncChoices(options)
SourceMethods
getChoices(items)
Source| Parameter | Type | Description | |
|---|---|---|---|
| * | items | ItemType[] |
Returns
One of the following:
Choice[]OR
[string, Choice[]][]retrieve(value,?deps)
Source| Parameter | Type | Description | |
|---|---|---|---|
| * | value | ValueType[]|ValueType | |
| deps | any |
Returns
useResolveItems(items)
Source| Parameter | Type | Description | |
|---|---|---|---|
| * | items | ItemType|ItemType[]|null |
Returns