[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][FIX] customsearch: trigger live filtering on input without TableSorter

"Olivier Kango \(@olivierkango\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69c3cdcaca0ed_3b1c14f84783b2@gitlab-sidekiq-low-urgency-cpu-bound-v2-847db959-vmv9g.mail>

Olivier Kango pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
8cb75e2c by Olivier Kango at 2026-03-25T13:50:05+02:00
[BP][FIX] customsearch: trigger live filtering on input without TableSorter
---
* [BP][FIX] customsearch: trigger live filtering on input without TableSorter
---
* [FIX] customsearch: trigger live filtering on input without TableSorter
---
* [FIX] customsearch: trigger live filtering on input without TableSorter

See merge request tikiwiki/tiki!9789

(cherry picked from commit fbc2991605a3b6489428a414bba17e7fdd1d844e)

See merge request tikiwiki/tiki!9845

(cherry picked from commit 503e3cd27c754156c858ddec9b2154eeba01ee67)

See merge request tikiwiki/tiki!9846

- - - - -


1 changed file:

- lib/wiki-plugins/wikiplugin_customsearch.php


Changes:

=====================================
lib/wiki-plugins/wikiplugin_customsearch.php
=====================================
@@ -321,11 +321,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'],
@@ -362,7 +365,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;
@@ -762,7 +765,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();
@@ -795,10 +798,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/8cb75e2cb0f16d461c54fe63c7dd22f972b402a3

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/8cb75e2cb0f16d461c54fe63c7dd22f972b402a3
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.