tablesorter 外部输入过滤器应用于两列并以输入值开始

tablesorter external input filter applied to two columns and starts with input value

我正在学习 table 分拣机并尝试制作过滤器外部输入。它过滤两列(姓名和姓氏)。过滤器必须搜索以输入文本字段内容开头的字符串。他们分开工作。

显然,无法使用 filter_startsWith 过滤超过两列:true。如果我把它们放在一起,它 returns 是一个空集。

HTML:

<input type="text" id="search" data-column="1,2" type="search"/>

脚本:

var tableSorterOptions = 
        {   
            widgets: ["filter","pager"],
            widgetOptions : 
            {
                filter_columnFilters: false,
                filter_external : '#search',
                filter_startsWith : true                    
            },
            debug: true
        };

        $(document).ready(function() 
        {       
            $('#tabla')         
                .tablesorter(tableSorterOptions);           
        });

我试过删除 filter_startsWith : true with:

        filter_defaultFilter :
        {
            1: '/^{q}/',
            2: '/^{q}/'
        },

在 widgetOptions 中,它可以从字符串 (/^{q}/) 的开头搜索姓名和姓氏 (1 & 2),但它不起作用。

可以给点小费吗

非常感谢

似乎有错误导致 javascript 错误。我刚刚修复它并推出了一个新版本 (v2.23.0)。 Here is a demo 使用此代码:

/* Documentation for this tablesorter FORK can be found at
* http://mottie.github.io/tablesorter/docs/
*/
$(function () {
    $('table').tablesorter({
        theme: 'blue',
        widgets: ['zebra', 'filter'],
        widgetOptions: {
            filter_columnFilters: false,
            filter_startsWith: true,
            filter_external : '#search',
            filter_defaultFilter: {
                // 7 = "any" match filter index (total table columns + 1)
                7 : '{q1} or {q2}'
            }
        }
    });
});