100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Fix for value 0 not being shown in dropdown (#1299)
Martin Peeters672c6bec045e
diff --git a/ui/component/or-mwc-components/src/or-mwc-input.ts b/ui/component/or-mwc-components/src/or-mwc-input.tsindex ad8e8d0ee..e2e04496d 100644--- a/ui/component/or-mwc-components/src/or-mwc-input.ts+++ b/ui/component/or-mwc-components/src/or-mwc-input.ts@@ -1522,7 +1522,8 @@ export class OrMwcInput extends LitElement {const mdcSelect = new MDCSelect(component);this._mdcComponent = mdcSelect;- if (!this.value) {+ const hasValue = (this.value !== null && this.value !== undefined);+ if (!hasValue) {mdcSelect.selectedIndex = -1; // Without this first option will be shown as selected}@@ -1831,7 +1832,7 @@ export class OrMwcInput extends LitElement {protected getSelectedTextValue(options?: [string, string][] | undefined): string {const value = this.value;- const values = Array.isArray(value) ? value as string[] : value ? [value as string] : undefined;+ const values = Array.isArray(value) ? value as string[] : value != null ? [value as string] : undefined;if (!values) {return "";}