[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] customsearch: trigger live filtering on input without TableSorter

"luci \(@luciash\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69c3bd438be77_3b18df08221af@gitlab-sidekiq-low-urgency-cpu-bound-v2-847db959-pkd9g.mail>

luci pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
fbc29916 by Olivier Kango at 2026-03-25T10:40:07+00:00
[FIX] customsearch: trigger live filtering on input without TableSorter
---
* [FIX] customsearch: trigger live filtering on input without TableSorter

See merge request tikiwiki/tiki!9789

- - - - -


1 changed file:

- lib/wiki-plugins/wikiplugin_customsearch.php


Changes:

=====================================
lib/wiki-plugins/wikiplugin_customsearch.php
=====================================
@@ -306,11 +306,14 @@ function wikiplugin_customsearch($data, $params)
         $offset = (int) $_SESSION["customsearch_$id"]["offset"];
     }
 
+    $autosearchdelay = ! empty($params['autosearchdelay']) ? max(0, (int) $params['autosearchdelay']) : 0;
+    $loadDelay = $autosearchdelay > 0 ? 0 : 1000;
+
     $options = [
         'searchfadetext' => tr('Loading...'),
         'searchfadediv' => $params['searchfadediv'],
         'results' => empty($params['destdiv']) ? "#customsearch_{$id}_results" : "#{$params['destdiv']}",
-        'autosearchdelay' => ! empty($params['autosearchdelay']) ? max(1500, (int) $params['autosearchdelay']) : 0,
+        'autosearchdelay' => $autosearchdelay,
         'searchonload' => (int) $params['searchonload'],
         'requireinput' => (bool) $params['requireinput'],
         'origrequireinput' => (bool) $params['requireinput'],
@@ -347,7 +350,7 @@ var customsearch$id = {
     },
     auto: function () {
     },
-    _executor: delayedExecutor(1000, function (cs) {
+    _executor: delayedExecutor($loadDelay, function (cs) {
         var selector = '#' + cs.options.searchfadediv;
         if (cs.options.searchfadediv.length <= 1 && $(selector).length === 0) {
             selector = '#customsearch_' + cs.id;
@@ -747,7 +750,7 @@ function cs_design_input($id, $fieldname, $fieldid, $arguments, $default, &$scri
     $script .= "
 (function (id, config, fieldname) {
     var field = $('#' + id);
-    field.on('change', function() {
+    var updateFilter = function () {
 
         var partial = '';
         var value = $(this).val();
@@ -780,10 +783,16 @@ function cs_design_input($id, $fieldname, $fieldid, $arguments, $default, &$scri
 
         customsearch$id.add($(this).attr('id'), filter);
         customsearch$id.offset = 0;
-    });
+    };
+
+    field.on('change', updateFilter);
+
+    if (field.is(':text, input[type=search], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=password]')) {
+        field.on('input', updateFilter);
+    }
 
     if (config['default'] || $(field).attr('type') === 'hidden') {
-        field.trigger('change');
+        field.change();
     }
 })('$fieldid', " . json_encode($arguments) . ", " . json_encode($fieldname) . ");
 ";



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/fbc2991605a3b6489428a414bba17e7fdd1d844e

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/fbc2991605a3b6489428a414bba17e7fdd1d844e
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.