From af5828da9d5da7a78a13f4feec65369d507a4f53 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 26 May 2017 18:10:49 +0200 Subject: [PATCH] Fix taglist-accounts does not get right value on the first load --- api/js/etemplate/et2_widget_taglist.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/et2_widget_taglist.js b/api/js/etemplate/et2_widget_taglist.js index 303ac7c8af..1d4ab2a079 100644 --- a/api/js/etemplate/et2_widget_taglist.js +++ b/api/js/etemplate/et2_widget_taglist.js @@ -1035,7 +1035,18 @@ var et2_taglist_account = (function(){ "use strict"; return et2_taglist.extend( this.deferred_loading++; this.egw().link_title('api-accounts', v, function(label) { this.deferred_loading--; - if (label) this.set_value(values); + if (label) + { + // Seems the magic suggest can not deal with broken taglist value + // like selected value with no label set and maxSelection set. This + // trys to first unset maxSelection and set value to magix suggest taglist + // object then calls set_value of the widget taglist, and at the end + // re-set the maxSelection option again. + if (this.options.maxSelection) this.taglist.setMaxSelection(null); + this.taglist.setValue([{id:v,label:label}]); + this.set_value(values); + this.taglist.setMaxSelection(this.options.maxSelection); + } }, this); } }