Skip to content

ui5-combobox: add selectionChange event #1651

Closed

Description

@MarcusNotheis

Is your feature request related to a problem? Please describe.
When using the MultiComboBox it is very convenient to get the selected items via the selectionChange event as they are passed as detail.items. The same is valid for the change event of ui5-select which gives you the selected option via detail.selectedOption. This makes it easy to use e.g. the HTML5 data- api to set keys and other required stuff on the options/items themselves and read the data in the change event. For the ui5-combobox this is currently not possible as it only gives you the selected text via e.target.value but you have no chance to find the selected item.

Describe the solution you'd like
The ui5-combobox should fire a selectionChange event just like the ui5-multicombobox which gives you the selectedItem via event.detail.

Describe alternatives you've considered

  1. Wait for the change event, access the DOM and find the ui5-cb-item which has an selected attribute and read the data from there
  2. Access the raw data (most probably array) and search for the selected text

In my option both solutions feel very cumbersome and the selectionChange event would be the cleanest approach.

Additional context
This issue is somehow related to #1447
Also raised via UI5/webcomponents-react#493

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions