> How can I use an arrayList of data objects instead ?
<sp:ComboBox placeholder="Type here" quiet=“true”
dataProvider=“{myArrayListProvider}"/>
> The spectrum combobox also doesn't have a change attribute. How do you
> execute an event on selecting from the list.
It looks like we forgot to add Event metadata for that.
Fixed.
https://github.com/unhurdle/spectrum-royale/commit/a53c16b59cc2b352adffbb570067e9fddcb9ec46
> On Feb 27, 2022, at 2:48 AM, Timothy Tokmang Wang <[email protected]>
> wrote:
>
> The spectrum combobox also doesn't have a change attribute. How do you
> execute an event on selecting from the list.
>
> On Sun, Feb 27, 2022 at 12:28 AM Roman Isitua <[email protected]
> <mailto:[email protected]>> wrote:
> How can I populate a spectrum combo box dynamically ? I intend to use an
> array list of data objects ?
>
> For spectrum List (sp:List) the following can be used
>
> <sp:List id="navLinks" className="home_side_nav" labelField="description"
> dataProvider="{newMenuItemList}" change="onSelectMenu(event)">
> <sp:beads>
> <js:DataItemRendererFactoryForArrayList/>
> <js:EasyDataProviderChangeNotifier/>
> <js:DynamicRemoveAllItemRendererForArrayListData/>
> </sp:beads>
> </sp:List>
>
>
> From the royale spectrum show case the code snippet was used.
>
> <sp:ComboBox placeholder="Type here" quiet="true">
> <sp:dataProvider>
> <fx:Array>
> <sp:MenuItem text="Ballard"/>
> <sp:MenuItem text="Freemont"/>
> <sp:MenuItem text="Greenwood"/>
> <sp:MenuItem isDivider="true"/>
> <sp:MenuItem text="United States of America" disabled="true"/>
> </fx:Array>
> </sp:dataProvider>
> </sp:ComboBox>
>
>
> In the above example a static fx array was used. How can I use an arrayList
> of data objects instead ?
>
>
>
> On Wed, Jan 12, 2022 at 5:21 PM Roman Isitua <[email protected]
> <mailto:[email protected]>> wrote:
> Understood. Thanks.
>
> On Wed, Jan 12, 2022 at 5:14 PM Harbs <[email protected]
> <mailto:[email protected]>> wrote:
>
>
>> On Jan 12, 2022, at 6:08 PM, Roman Isitua <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> What is the purpose of <js:ArrayListSelectionModel /> ? since it was no
>> longer necessary
>
> It’s necessary in Royale Basic to use ArrayLists.
>
> In Spectrum, there’s a default ListModel which correctly handles both both
> Array and ArrayList data.
>
>>
>> Also, another question
>> which will you recommend one uses ? why should one choose Array over
>> ArrayList or ArrayList over Array.
>
> Array is simpler. There’s less overhead. If you have data which doesn’t
> change, use Array.
> If you need the list to update when data changes, use ArrayList.