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]> wrote:
> Understood. Thanks.
>
> On Wed, Jan 12, 2022 at 5:14 PM Harbs <[email protected]> wrote:
>
>>
>>
>> On Jan 12, 2022, at 6:08 PM, Roman Isitua <[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.
>>
>