From c052bd313d44db1e281dab491065182138005657 Mon Sep 17 00:00:00 2001 From: Adrian Hangan Date: Sat, 11 Feb 2017 17:24:20 +0200 Subject: [PATCH] single selection fix for: selected value becomes null if dropdown is closed without selecting any option --- bower.json | 2 +- etools-searchable-multiselection-menu.html | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index 710d5d0..460d703 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "etools-searchable-multiselection-menu", "description": "Dropdown menu with search and multiple options selection", - "version": "1.0.22", + "version": "1.0.23", "license": "https://github.com/unicef-polymer/etools-searchable-multiselection-menu/blob/master/LICENSE.md", "main": "etools-searchable-multiselection-menu.html", "dependencies": { diff --git a/etools-searchable-multiselection-menu.html b/etools-searchable-multiselection-menu.html index 640e3ae..5f37666 100644 --- a/etools-searchable-multiselection-menu.html +++ b/etools-searchable-multiselection-menu.html @@ -474,7 +474,11 @@ * value and selectedValues must be updated with that object data */ this.set('value', value[0]); - this.set('selectedValues', [value[0][this.optionValue]]); + this.set('selectedValues', value[0][this.optionValue]); + } else if (!this.multi && !Array.isArray(value) && + typeof value === 'object' && value[this.optionValue]) { + // single selection, value is just an object from options + this.set('selectedValues', value[this.optionValue]); } }, // get esmm single selection selected label to be displayed