Provide a public method to change the selection of ui5-select programmatically
See original GitHub issueDiscuss and provide a suitable public API to change selection.
We have a read-only selectedOption
property:
/**
* Currently selected option
* @readonly
* @type { ui5-option }
* @public
*/
get selectedOption() {
return this.options.find(option => option.selected);
}
What one must currently do is something like:
[...$0.children].forEach(option => option.selected = option.textContent === "Compact")
We need an official API for this.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:10 (6 by maintainers)
Top Results From Across the Web
sap.ui.table.Table - Select Row Programmatically by Content
The change handler onRowsDataChange is fired on any ChangeReason. This keeps the selection from being removed whatever happens to the table rows ...
Read more >SAPUI5 - Table, select multiple rows programmatically.
My question is if there is any way I can programmatically(not by clicking on the table rows) select more than 1 row from...
Read more >sap.ui.table.Table - API Reference - Demo Kit - SAPUI5 SDK
Sets the zero-based index of the currently selected item. This method removes any previous selections. When the given index is invalid, the call...
Read more >ARIA2: Identifying a required field with the aria-required property
The objective of this technique is to provide programmatic indication that ... if a user must fill in an address field, then aria-required...
Read more >Tree - UI5 Web Components - SAP
Properties/Attributes · If a tree node has both selected and indeterminate set to true , it is displayed as partially selected. · If...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I would also also like to see a suitable public API.
BR Julian
We had a discussion on the topic and decided the declarative way of selecting an option is enough and recommended.
We considered providing a setter, a method to select an option as:
But, the effort is not much different from what is currently possible
That’s why for time being, we don’t plan to introduce such an API.