Javascript Tablesorter-一列表,删除排序,但保留对该列的搜索
。如果不同时禁用对该列的搜索,我就无法禁用排序功能。我用的是有帮助的箱子 下面是JS编码Javascript Tablesorter-一列表,删除排序,但保留对该列的搜索,javascript,jquery,tablesorter,Javascript,Jquery,Tablesorter,。如果不同时禁用对该列的搜索,我就无法禁用排序功能。我用的是有帮助的箱子 下面是JS编码 $(function() { var $table = $('table').tablesorter({ theme: 'blue', widgets: ["zebra", "filter"], widgetOptions : { // filter_anyMatch replaced! Instead use the filter_external option
$(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;
});
})) 您需要做的就是在标题中添加一个
“sorter false”
类名:
<th class="column-1 sorter-false"></th>
谢谢。我之前确实尝试过这个方法,但上下箭头不会消失。如果您使用的是自定义主题,请确保包含此css定义
.tablesorter thead.sorter false{background image:none;}
()