MCPcopy Index your code
hub / github.com/UI5/webcomponents / _select

Method _select

packages/main/src/Select.ts:796–814  ·  view source on GitHub ↗
(index: number)

Source from the content-addressed store, hash-verified

794 }
795
796 _select(index: number) {
797 const selectedIndex = this._selectedIndex;
798 if (index < 0 || index >= this.options.length || this.options.length === 0) {
799 return;
800 }
801 if (this.options[selectedIndex]) {
802 this.options[selectedIndex].selected = false;
803 }
804
805 const selectedOption = this.options[index];
806 if (selectedIndex !== index) {
807 this.fireDecoratorEvent("live-change", { selectedOption });
808 }
809
810 selectedOption.selected = true;
811 if (this._valueStorage !== undefined) {
812 this._setValueByOption(selectedOption);
813 }
814 }
815
816 /**
817 * The user clicked on an item from the list

Callers 3

_afterCloseMethod · 0.95
_fireChangeEventMethod · 0.95

Calls 1

_setValueByOptionMethod · 0.95

Tested by

no test coverage detected