寻找一种使用tablesorter内部过滤器小部件使用Select2控件的方法



内部过滤器小部件与外部滤镜相反,如本示例中所述:

http://mottie.github.io/tablesorter/beta-testing/example-example-expample-external-filters-using-select2.html

我正在寻找类似于带有占位符的前两个外部过滤器框的行为:字母数字和字母数字标签,但我希望该行为在表格中。这是我尝试做的:

<th class="filter-select2" data-placeholder="select something">

这不起作用,但是如果我将"filter-select2"更改为 "filter-select",那么它会。

我正在寻找一种方法来破解/自定义现有表摩托车行为以允许内部使用select2。我不知道JS和图书馆可以自己尝试。

这是我用来初始化TableSorter库的JavaScript片段。

$('#table1').tablesorter({
    theme : 'ice',
    cssInfoBlock : 'tablesorter-no-sort',
    widgets: ['zebra', 'stickyHeaders', 'filter']
});

我刚刚为Select2插件添加了一些过滤器格式化代码。使用如下:

$('table').tablesorter({
  theme: 'blue',
  widthFixed: true,
  widgets: ['zebra', 'filter'],
  widgetOptions : {
    filter_reset : 'button.reset',
    filter_formatter : {
      // Alphanumeric (match)
      0 : function($cell, indx){
        return $.tablesorter.filterFormatter.select2( $cell, indx, {
          match : true, // adds "filter-match" to header
          cellText : 'Match: ',
          width: '85%'
        });
      }
    }
  }
});

最新更新