Getting Label of the Dropdown component

I am trying to get the label of the selected dropdown item in perspective and assign it to a label property that I created in the dropdown.

OK. You have created a custom property in the dropdown component. You wan it to return the value of the selected option label.

So I have the following expression configured on the label property, ...
{this.props.options[{this.props.value}].label}

You can't nest { } parameters like that. Expression Language does not allow it.

{value}['options'][{value}['index']]['label']

How it works:

{value}['options'] returns the whole list of options.
{value}['index'] returns the pointer.
['label'] returns the label entry for the selected option.

There is a simpler way: make the label and value the same!

Jazz dropdown

Now the dropdown's value property gives you the parameter for your named query.

1 Like