How do I create a drop-down menu with multi-select behavior?
The list input component only supports a single selection, but you can use a callout to easily create a drop-down menu that supports multiple selections:
Create a Repeater Inside a Symbol
Create a repeater with multi-select behavior.
Right-click the group that holds the repeater, and select Convert to Symbol.
When prompted, name the symbol dropDown
, and click OK.
Set the Callout Properties
Create a text component that represents the collapsed menu:
Right-click the Stage in the Document window or Outline, and select Insert > Components > Text.
Style the appearance and content of the text component using the Property Inspector.
Select the text component in the Outline, and in the Callout properties:
For Callout Type, select Events.
for Symbol, enter dropDown
.
Set Position to bottom left.
Set Anchor to top left.
Hover over the Show Callout or Show Trigger property until a blue dot appears, and double-click the blue dot.
Hover over the Hide Callout or Hide Trigger property until a blue dot appears, and double-click the blue dot.
A small binding dialog appears containing the two properties.
With the text component selected, in the Advanced Properties panel, find onClickOn and bind it to the Show Callout property in the small binding dialog.
With the text component selected, in the Advanced Properties panel, find onClickOff and bind it to the Hide Callout property in the small binding dialog.
Close the small binding dialog.
Track Item Selection
In the Symbols panel, right-click dropDown, and select Edit.
In the Outline, click Dataflow to open dataflow for the symbol.
Add a Select Rows block to the dataflow.
Bind the Table block that drives the repeater to the input property of the Select Rows block.
In the Property Inspector, in the Selection properties, find the Selected Index property, and bind it to the indexes property of the Select Rows block.
In the Outline, right-click the symbol and select Edit Properties.
Drag a tabledata property into the right hand column of the Symbol Parameters dialog.
Double-click the label of the table to rename it selectedOptions
Bind the output table of the Select Rows block to the selectedOptions parameter.
Close the Symbol Parameters dialog and the Dataflow window, and click OK to exit symbol editing mode.
In Preview mode, expand the drop-down and select some items. Then, select "callout" in the Outline and open the table, to access information about the currently selected rows.