tablesort 多选下拉列表
tablesort multiselect dropdown
我正在使用 tablesorter 下拉列表,使用它我可以从中 select 一个元素。我希望能够 select 多个元素。有没有办法使用 table 分拣机来做到这一点?
我试了一下 here but I am not sure if it says of any direct way to do it. Also this issue 好像提示没有直接的方法?
编辑:
代码
filter_functions : {
0 : {
"a" : function(e, n, f, i, $r) { return e===f; },
"b" : function(e, n, f, i, $r) { return e===f; },
"c" : function(e, n, f, i, $r) { return e===f; },
"d" : function(e, n, f, i, $r) { return e===f; }
}
您可以将 filter_formatter
选项与 extra filter-formatter select2 code to use the select2 plugin. Here is a demo 一起使用。
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
});
}
}
注意:请注意,$.tablesorter.filterFormatter.select2
功能尚不适用于 select2 v4.0.0 beta。使用 respitory 中包含的 select2 v3.4.6。
我正在使用 tablesorter 下拉列表,使用它我可以从中 select 一个元素。我希望能够 select 多个元素。有没有办法使用 table 分拣机来做到这一点?
我试了一下 here but I am not sure if it says of any direct way to do it. Also this issue 好像提示没有直接的方法?
编辑:
代码
filter_functions : {
0 : {
"a" : function(e, n, f, i, $r) { return e===f; },
"b" : function(e, n, f, i, $r) { return e===f; },
"c" : function(e, n, f, i, $r) { return e===f; },
"d" : function(e, n, f, i, $r) { return e===f; }
}
您可以将 filter_formatter
选项与 extra filter-formatter select2 code to use the select2 plugin. Here is a demo 一起使用。
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
});
}
}
注意:请注意,$.tablesorter.filterFormatter.select2
功能尚不适用于 select2 v4.0.0 beta。使用 respitory 中包含的 select2 v3.4.6。