object-dropdown (legacy docs)

These object-dropdown docs are out of date

New functionality and features were added to object-dropdown in version 4.84.0 of the JourneyApps runtime. Please refer to the latest docs here.

Initialization of Data in JavaScript

Object dropdowns use a database query or array to determine what objects are displayed in it.

Note: If there are more than 12 items displayed, a type-ahead filter is displayed.

<var name="all_items" type="query:item" />
<!-- OR -->
<var name="all_items_array" type="array:item" />
function init() {
     view.all_items = DB.item.all();
     // OR
     view.all_items_array = DB.item.all().toArray();
}

Storing the selected object in a variable

Since a dropdown list allows a user to select an option, you need a variable in which to store the selected object, and then specify that variable at bind="" in the list.

<var name="all_items" type="query:item" />
<var name="selected_item" type="item" />

<object-dropdown query="all_items" bind="selected_item" label="All Items:" />

Configuration

Last updated