noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 106/119: Filter_Multiselect : make a search o


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 106/119: Filter_Multiselect : make a search on select (multi-row)
Date: Mon, 26 Oct 2020 18:27:38 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 251acf11cd9606ab2163805cc97021ae568ec0dc
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Wed Oct 14 15:54:37 2020 +0200

    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 66c9c83..fa05158 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)) {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]