Tablesorter - 从列中删除过滤器

时间:2013-09-05 21:58:20

标签: javascript jquery properties options tablesorter

我想从过滤中排除某些列 - 就像我可以使用sorder一样,但我不确定如何使用小部件,是否有一种简单的方法可以做到这一点?

jQuery(document).ready(function($) {

  $("#eventTable").tablesorter({
    widthFixed : true,
    widgets: ["filter"],

    widgetOptions : {
      filter_childRows   : false,
      filter_hideFilters : false,
      filter_ignoreCase  : true,
      filter_cssFilter : 'tablesorter-filter',

      filter_functions : {
        1 : function(e, n, f, i) {
          return e === f;
        }
      }
    }
  });
});

4 个答案:

答案 0 :(得分:22)

您可以使用标题选项或将“filter-false”类添加到该列的TH标记。

标题选项记录在tablesorter documentation中 - 单击配置表的属性列中的“标题”。该选项的语法是:

headers: { 0: { filter: false} }

如果您不想显示默认的禁用过滤器格式,请使用以下CSS:

.tablesorter thead .disabled {display: none}

答案 1 :(得分:11)

您可以使用以下方法禁用特定列的过滤器和/或排序:

<th data-sorter="false" data-filter="false"></th>

答案 2 :(得分:5)

禁用特定列使用的过滤器<th data-sorter="false"></th>

禁用特定列使用的排序<th data-sorter="false" data-filter="false"></th>

将它们组合起来禁用它们。 <style> .tablesorter thead .disabled { display:none; } </style>

这将导致课程&#34;禁用&#34;将应用于用于过滤的文本框。文本框将显示为灰色。如果你想完全隐藏文本框,只需添加这个

NullPointerException: Attempt to invoke virtual method 'android.hardware.Camera$Parameters 
android.hardware.Camera.getParameters() on a null object reference
at {PackageName}.MainView.lockAutoExposure()

答案 3 :(得分:0)

如果要在页面加载之前隐藏所有过滤器,请将此代码添加到CSS文件中。

squares = [[lines(1)]]    

for line1 in lines:
    for square in squares:
        for line2 in square:
            if line1 != line2:
                if intersects(line1, line2):
                    square.append(line1)
                else:
                    squares.append([line1])