[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 36/38: Fix : Bug cannot filter a list of elem
From: |
dwm |
Subject: |
[Noalyss-commit] [noalyss] 36/38: Fix : Bug cannot filter a list of element |
Date: |
Sun, 18 Feb 2024 07:30:48 -0500 (EST) |
sparkyx pushed a commit to branch devel
in repository noalyss.
commit 8d3f5b61371a0ab554242d43c50b554681748fcc
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sun Feb 18 13:05:50 2024 +0100
Fix : Bug cannot filter a list of element
---
html/js/noalyss_script.js | 20 ++++++++++++--------
include/lib/html_input.class.php | 12 +++++++++++-
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js
index dace8e4b0..540f0b4aa 100644
--- a/html/js/noalyss_script.js
+++ b/html/js/noalyss_script.js
@@ -2266,7 +2266,7 @@ function filter_table(phrase, _id, colnr, start_row) {
}
/**
* filter quickly a list
- * @param phrase : DOM id of the input text where we find the word to seach
+ * @param phrase : DOM id of the input text where we find the word to seach,
the searchable content use the className searchContent
* @param _id : id of the list
* @returns nothing
* @see HtmlInput::filter_list
@@ -2277,20 +2277,24 @@ function filter_list(phrase, _id) {
var words = $(phrase).value.toLowerCase();
var l_list = document.getElementById(_id);
- var ele;
+
var tot_found = 0;
for (var r = 0; r < l_list.childNodes.length; r++) {
var found = 0;
- if (l_list.childNodes[r].nodeType != 1 ){
+
+ if (l_list.childNodes[r].nodeType != 1) {
continue;
}
- if (l_list.childNodes[r].childElementCount == 0)
- {
- ele = l_list.childNodes[r].innerHTML;
- } else {
- ele = l_list.childNodes[r].childNodes[0].innerHTML;
+ let ele = "";
+ let la_content =
l_list.childNodes[r].getElementsByClassName("search-content");
+
+ let e = 0;
+ for (e = 0; e < la_content.length; e++) {
+ ele += la_content[e].innerText;
}
+
+ console.debug (`ele = ${ele}`);
if (ele.toLowerCase().indexOf(words) >= 0) {
tot_found++;
l_list.childNodes[r].style.display = 'block';
diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php
index a18b85a68..86e2f7465 100755
--- a/include/lib/html_input.class.php
+++ b/include/lib/html_input.class.php
@@ -1050,8 +1050,18 @@ class HtmlInput
return $r;
}
/**
- * Display a field for searching an element in a list
+ * @brief Display a field for searching an element in a list, the
searchable text must be in an element with the className search-content
* @param string $p_list_id DOM ID of the list (ul or ol)
+ * @code
+
+ <ul id="xx">
+ <li><span class="search-content"> Content used for searching</span>
Content not used for search </li>
+ <li><span class="search-content"> Content used for searching</span> <a
href="">Content not used for search</a> </li>
+ <li><span class="search-content"> Content used for searching</span>
Content not used for search </li>
+ <li><a href=""><span class="search-content"> Content used for
searching</span> </a></li>
+ <ul>
+ *
+ * @endcode
* @return string
*/
static function filter_list($p_list_id)
- [Noalyss-commit] [noalyss] 33/38: CARD : add button to epxort to PDF, (continued)
- [Noalyss-commit] [noalyss] 33/38: CARD : add button to epxort to PDF, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 26/38: Task #2321: erreur de numérotation, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 29/38: cosmetic, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 10/38: Filtre ne fonctionne pas tva_search_id est vide, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 11/38: Sécurité : bloquer le changement de date des opérations, Renforce mode strict : change de date impossible, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 17/38: FOLLOWUP : nom contact pas affiché, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 23/38: Merge branch 'devel', dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 13/38: FOLLOWUP : Cosmetic nombre pièces, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 22/38: Fix : auto numbering receipt, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 32/38: cosmetic, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 36/38: Fix : Bug cannot filter a list of element,
dwm <=
- [Noalyss-commit] [noalyss] 27/38: Nouvelle fonction pour ajouter des attributs à un élément DOM, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 31/38: DB protect against JS Injection, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 24/38: Nouveau #00022980002298: detail fiche , historique du suivi, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 35/38: Merge devel, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 09/38: Task #2321: Sécurité : empêcher changement de numéro de pièce, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 16/38: Follow-Up : bug ne peut pas ajouter fichier sur nouvel événement, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 18/38: Fix cosmetic bug : duplicate operation with autoreverse VAT has an VAT amount, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 20/38: Fix : auto numbering receipt, dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 21/38: Merge branch 'devel', dwm, 2024/02/18
- [Noalyss-commit] [noalyss] 25/38: cosmetic, dwm, 2024/02/18