From 251acf11cd9606ab2163805cc97021ae568ec0dc Mon Sep 17 00:00:00 2001 From: sparkyx Date: Wed, 14 Oct 2020 15:54:37 +0200 Subject: [PATCH] Filter_Multiselect : make a search on select (multi-row) --- html/js/scripts.js | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/html/js/scripts.js b/html/js/scripts.js index 66c9c832f..fa05158dc 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -2201,7 +2201,7 @@ function filter_table(phrase, _id, colnr, start_row) { } if (tot_found == 0) { if ($('info_' + _id)) { - $('info_' + _id).innerHTML = content[69] + $('info_' + _id).innerHTML = content[69]; } } else { if ($('info_' + _id)) { @@ -2247,7 +2247,46 @@ function filter_list(phrase, _id) { } if (tot_found == 0) { if ($('info_' + _id)) { - $('info_' + _id).innerHTML = content[69] + $('info_' + _id).innerHTML = content[69]; + } + } else { + if ($('info_' + _id)) { + $('info_' + _id).innerHTML = " "; + } + } +} + +/** + * @brief filter quickly a select + * @param phrase : DOM id of the input text where we find the word to seach + * @param _id : id of the list + * @returns nothing + * @see HtmlInput::filter_list + */ +function filter_multiselect(phrase, _id) { + $('info_div').innerHTML = content[65]; + $('info_div').style.display = "block"; + var words = $(phrase).value.toLowerCase(); + var l_list = document.getElementById(_id); + + var tot_found = 0; + + for (var r = 0; r < l_list.options.length; r++) { + var found = 0; + var ele = l_list.options[r].text; + + if (ele.toLowerCase().indexOf(words) >= 0) { + tot_found++; + l_list.options[r].style.display = 'block'; + } else { + l_list.options[r].style.display = 'none'; + } + $('info_div').style.display = "none"; + $('info_div').innerHTML = ""; + } + if (tot_found == 0) { + if ($('info_' + _id)) { + $('info_' + _id).innerHTML = content[69]; } } else { if ($('info_' + _id)) {