我想在我的 tablesorter 表上使用 select2 的多项选择功能。
但我只想基于一列进行过滤。我知道 data-filter="false",但是这个简单的在搜索标题中添加了一个“禁用”属性。
我可以将显示属性设置为“无”,但你会得到这个:http ://antigraffiti.wpengine.com
我想知道的是:
- 有没有办法改变这种行为,所以我可以向 .select2col0 td 添加一个 colspan?
- 有没有办法将 select2 分配给 filter_external?
这是我目前正在使用的功能:
jQuery(document).ready(function($)
{
var $table = $('#taxonomyTable').tablesorter(
{
widgets: ['filter'],
widgetOptions : {
// filter_external : '#filter-posts',
filter_reset: '.close-icon',
filter_searchDelay: 75,
// filter_saveFilters : true,
// filter_columnFilters: true,
filter_formatter : {
// default settings on first column
0 : function($cell, indx){
return $.tablesorter.filterFormatter.select2( $cell, indx, {
// *** select2 filter formatter options ***
cellText : '', // Text (wrapped in a label element)
match : true, // adds "filter-match" to header & modifies search
value : [], // initial select2 values
// *** ANY select2 options can be included below ***
// (showing default settings for this formatter code)
multiple : true, // allow multiple selections
width : '100%' // reduce this width if you add cellText
});
}
}
}
});
});