From 99e97d2bfc1171ab80658f0014b5fd8845b9d2e3 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 4 Mar 2014 17:27:19 +0000 Subject: [PATCH] fixed Selecting an InfoLog category does not show this cat but "Loading" --- etemplate/js/et2_extension_nextmatch.js | 26 ++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/etemplate/js/et2_extension_nextmatch.js b/etemplate/js/et2_extension_nextmatch.js index 563e76ce3a..97c14e3e5c 100644 --- a/etemplate/js/et2_extension_nextmatch.js +++ b/etemplate/js/et2_extension_nextmatch.js @@ -2064,12 +2064,28 @@ var et2_nextmatch_header_bar = et2_DOMWidget.extend(et2_INextmatchHeader, * is to warn & not set it, but for nextmatch we'll just add it * in, and let the server either set it properly, or ignore. */ - if(value && child.instanceOf(et2_selectbox) && typeof child.options.select_options[value] == 'undefined') + if(value && child.instanceOf(et2_selectbox)) { - var old_options = child.options.select_options; - // Actual label is not available, obviously, or it would be there - old_options[value] = child.egw().lang("Loading"); - child.set_select_options(old_options); + var found = typeof child.options.select_options[value] != 'undefined'; + // options is array of objects with attribute value&label + if (jQuery.isArray(child.options.select_options)) + { + for(var o=0; o < child.options.select_options.length; ++o) + { + if (child.options.select_options[o].value == value) + { + found = true; + break; + } + } + } + if (!found) + { + var old_options = child.options.select_options; + // Actual label is not available, obviously, or it would be there + old_options[value] = child.egw().lang("Loading"); + child.set_select_options(old_options); + } } child.set_value(value); }