Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquery表排序器限制筛选器的长度_Jquery_Tablesorter - Fatal编程技术网

jquery表排序器限制筛选器的长度

jquery表排序器限制筛选器的长度,jquery,tablesorter,Jquery,Tablesorter,我使用的是TableSorter版本2.28.1。我正在使用带有母版页的.net。我在我的aspx Gridview控件上设置了一个过滤器。我的客户希望我将过滤器的长度限制为仅3个字符。过滤器所在列中所有值的长度仅为3 有没有办法限制用户在过滤框中输入内容的长度 我试过这个 widgetOptions: { group_forceColumn: [0], group_enforceSort: true, filter_onlyAvail: { 1: function (e, n, f,

我使用的是TableSorter版本2.28.1。我正在使用带有母版页的.net。我在我的aspx Gridview控件上设置了一个过滤器。我的客户希望我将过滤器的长度限制为仅3个字符。过滤器所在列中所有值的长度仅为3

有没有办法限制用户在过滤框中输入内容的长度

我试过这个

widgetOptions: {
group_forceColumn: [0],
group_enforceSort: true,
filter_onlyAvail: {
    1: function (e, n, f, i, $r, c, data) {

        return f.toString().substring(0, 3);
    }
}
}

但它似乎什么也没做。然而,我确实读到,我需要把“过滤器选择”类名放在标题中。如何为Gridview执行此操作?现在,为了在Gridview中实现这一点,我执行以下操作来获取表中的“Thead”

        $("#<% =gvContractors.ClientID %> tbody").before("<thead><tr></tr></thead>");
        $("#<% =gvContractors.ClientID %> thead tr").append($("#<% =gvContractors.ClientID %> th"));
        $("#<% =gvContractors.ClientID %> tbody tr:first").remove();
(“#tbody”)。在(“)之前; 美元(“#thead tr”)。追加($(“#th”); $(“#tbody tr:first”).remove(); 试试这个():

试试这个():

我添加了一个“.eq(1)”,将限制仅限于列“1”。“initialized:function(table){$(table).find('.tablesorter filter').eq(1).attr('maxlength','3');}”,我添加了一个“.eq(1)”,将限制仅限于列“1”。已初始化:函数(表){$(表).find('.tablesorter筛选器').eq(1).attr('maxlength','3');}
$(function() {
  $('#<% =gvContractors.ClientID %>').tablesorter({
    theme: 'blue',
    widgets: ['zebra', 'filter'],
    initialized: function(table) {
        $(table).find('.tablesorter-filter').attr('maxlength', '3');
    }
  });
});
$("#<% =gvContractors.ClientID %> thead .tablesorter-filter:eq(1)")