我想为某些列禁用分拣机和过滤器。 但是,当我执行以下功能时,它会禁用其中一个(分拣机或过滤器)
$('.tablesorter').tablesorter({
theme: 'blue',
widthFixed: true,
widgets: [ 'stickyHeaders', 'columnSelector','filter'],
textExtraction: function(node, table, cellIndex){
return $(node).text().replace(/\s'/g,'');
},
headers: {{6: { sorter: false},7: { sorter: false},8: { sorter: false},6: { filter: false},7: { filter: false},8: { filter: false}},
widgetOptions : {
// Use the $.tablesorter.storage utility to save the most recent filters
dateFormat: "dd/mm/yyyy",
filter_serversideFiltering: true,
filter_saveFilters : false,
// jQuery selector string of an element used to reset the filters
filter_reset : 'button.reset',
// add custom selector elements to the filter row
filter_formatter : {
/*0 : function($cell, indx){
return $.tablesorter.filterFormatter.uiDatepicker( $cell, indx, {
dateFormat: 'dd/mm/yyyy',
changeMonth: true,
changeYear : true
});
},*/
// Alphanumeric (match)
4 : function($cell, indx){
return $.tablesorter.filterFormatter.select2( $cell, indx, {
match : true, // adds "filter-match" to header
// cellText : 'Select: ', // Cell text
width: '90%', // adjusted width to allow for cell text
value: [<%=createdBy%>], // initial values
placeholder: "Search.."
});
},
5 : function($cell, indx){
return $.tablesorter.filterFormatter.select2( $cell, indx, {
match : true, // adds "filter-match" to header
// cellText : 'Select: ', // Cell text
width: '90%', // adjusted width to allow for cell text
value: [<%=actions%>], // initial values
placeholder: "Search.."
});
},
0 : function($cell, indx){
return $.tablesorter.filterFormatter.uiDatepicker( $cell, indx, {
from : new Date(), // default from date
to : new Date(), // default to date
// dateFormat : 'dd/MON/yy',
changeMonth : true,
changeYear : true,
cellText : "",
dateFormat: "dd/mm/yy"
});
}
/*0 : function($cell, indx){
return $.tablesorter.filterFormatter.uiDateCompare( $cell, indx, {
cellText : '', // text added before the input
compare : ['After', 'Before' ],
selected : 3,
// jQuery UI datepicker options
// defaultDate : '1/1/2014', // default date
changeMonth : true,
changeYear : true,
placeholder: "Date",
dateFormat : 'dd/mm/yy'
});
}*/
},
// option added in v2.16.0
filter_selectSource : {
// Alphanumeric match (prefix only)
// added as select2 options (you could also use select2 data option)
4 : function(table, column) {
return [<%=createdBy%>];
},
5 : function(table, column) {
return [<%=actions%>];
},
},
filter_placeholder : {
from : 'From...',
to : 'To...'
}
},
});
在此函数之上初始化表格分类器和过滤器功能。 让我知道是否有人想要更多细节? 有人可以帮我吗?