Tablesorter - 一个列表,删除排序但继续搜索该列

时间:2015-09-29 22:13:47

标签: javascript jquery tablesorter

So here is a link to the table。我也无法禁用排序功能,也不会禁用对该列的搜索。我正在使用有助于filter widget external search的情况。

这是JS编码

$(function() {

var $table = $('table').tablesorter({
    theme: 'blue',
    widgets: ["zebra", "filter"],
    widgetOptions : {
        // filter_anyMatch replaced! Instead use the filter_external option
        // Set to use a jQuery selector (or jQuery object) pointing to the
        // external filter (column specific or any match)
        filter_external : '.search',
        // add a default type search to the first name column
        filter_defaultFilter: { 1 : '~{query}' },
        // include column filters
        filter_columnFilters: false,
        filter_placeholder: { search : 'Search...' },
        filter_saveFilters : true,
        filter_reset: '.reset'

    }
});
// make demo search buttons work
$('button[data-column]').on('click', function(){
    var $this = $(this),
        totalColumns = $table[0].config.columns,
        col = $this.data('column'), // zero-based index or "all"
        filter = [];

    // text to add to filter
    filter[ col === 'all' ? totalColumns : col ] = $this.text();
    $table.trigger('search', [ filter ]);
    return false;
});

});

1 个答案:

答案 0 :(得分:3)

您需要做的就是在标题中添加"sorter-false"类名称:

<th class="column-1 sorter-false"></th>

Here is a demo