require(["esri/widgets/ValuePicker/ValuePickerCollection"], (ValuePickerCollection) => { /* code goes here */ });
import ValuePickerCollection from "@arcgis/core/widgets/ValuePicker/ValuePickerCollection.js";
esri/widgets/ValuePicker/ValuePickerCollection
This class represents an ordered collection of values that can be assigned to the component property of a ValuePicker widget and can be interacted with at runtime. See Using an arbitrary collection component to present predefined list section for more information how to set this up.
// Assign a collection of objects to the ValuePicker.
const collection = new Collection([
{ name: "Isaac Newton", dob: new Date(1643, 0, 4)},
{ name: "Albert Einstein", dob: new Date(1879, 2, 14)},
{ name: "Ernest Rutherford", dob: new Date(1871, 7, 20)}
]);
const valuePicker = new ValuePicker({
component: new ValuePickerCollection({ collection }),
values: [collection.at(0)]
});
reactiveUtils.watch(
() => valuePicker.values,
(values) => {
const scientist = values[0];
console.log(`${scientist.name} was born on ${scientist.age.toDateString()}`);
}
);
Constructors
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
A collection of values that can be navigated or animated with the play, next, and previous buttons on the ValuePicker widget.. | ValuePickerCollection | ||
For ValuePickerCollection the type is always "collection". | ValuePickerCollection |
Property Details
-
collection
collection Collectionautocast
-
A collection of values that can be navigated or animated with the play, next, and previous buttons on the ValuePicker widget..
- Default Value:null
Exampleconst valuePicker = new ValuePicker({ values: ["hybrid"] component: new ValuePickerCollection({ collection: ["hybrid", "oceans", "osm"] // autocast to Collection }) });
-
type
type Stringreadonly
-
For ValuePickerCollection the type is always "collection".