tablesorter plugin이 추가 된 테이블이 있습니다. filter widget과 pager plugin을 모두 사용하도록 설정했습니다.jQuery Tablesorter 필터가 호출기를 업데이트하지 않습니다.
필자가 겪고있는 문제는 필터 입력에 값을 입력 할 때 호출기를 업데이트하지 않으며 (총 결과 및 호출기가 페이지 수를 설정하는 경우)입니다.
또한 전체 테이블이 아니라 페이징 된 결과 만 필터링하는 것처럼 보입니다.
이 방법으로 작동시킬 수 있습니까?
설명서를 살펴본 결과 어떻게 작동하는지 볼 수 없었습니다 (또한 js가 좋지 않음).
모든 도움을 주셨습니다.
내 tablesorter에 설정 :
var pagerOptions = {
// target the pager markup - see the HTML block below
container: $(".pager"),
// output string - default is '{page}/{totalPages}'; possible variables: {page}, {totalPages}, {startRow}, {endRow} and {totalRows}
output: '{startRow} to {endRow} ({totalRows})',
// apply disabled classname to the pager arrows when the rows at either extreme is visible - default is true
updateArrows: true,
// starting page of the pager (zero based index)
page: 0,
// Number of visible rows - default is 10
size: 10,
// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty
// table row set to a height to compensate; default is false
fixedHeight: true,
// remove rows from the table to speed up the sort of large tables.
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
removeRows: true,
// css class names of pager arrows
cssNext: '.next', // next page arrow
cssPrev: '.prev', // previous page arrow
cssFirst: '.first', // go to first page arrow
cssLast: '.last', // go to last page arrow
cssPageDisplay: '.pagedisplay', // location of where the "output" is displayed
cssPageSize: '.pagesize', // page size selector - select dropdown that sets the "size" option
// class added to arrows when at the extremes (i.e. prev/first arrows are "disabled" when on the first page)
cssDisabled: 'disabled' // Note there is no period "." in front of this class name
};
$.tablesorter.addParser({
id: "datetime",
is: function(s) {
return false;
},
format: function(s,table, cell) {
s = s.replace(/\-/g,"/");
s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1");
return $.tablesorter.formatFloat(new Date(s).getTime());
},
type: "numeric"
});
$("#results").tablesorter({
// initialize zebra striping and filter widgets
widgets: ["zebra", "filter"],
// headers: { 5: { sorter: false, filter: false } },
widgetOptions : {
// css class applied to the table row containing the filters & the inputs within that row
filter_cssFilter : 'tablesorter-filter',
// If there are child rows in the table (rows with class name from "cssChildRow" option)
// and this option is true and a match is found anywhere in the child row, then it will make that row
// visible; default is false
filter_childRows : true,
// Set this option to true to use the filter to find text from the start of the column
// So typing in "a" will find "albert" but not "frank", both have a's; default is false
filter_startsWith : false,
// Set this option to false to make the searches case sensitive
filter_ignoreCase : true,
// Delay in milliseconds before the filter widget starts searching; This option prevents searching for
// every character while typing and should make searching large tables faster.
filter_searchDelay : 300,
// See the filter widget advanced demo on how to use these special functions
filter_functions : {
4 : function(e, n, f, i) {
alert(e);
console.log(e);
if (e != "") {
return e === f;
}
}
},
empty: 'bottom',
dateFormat : "ddmmyyyy"
},
widthFixed: true
})
.tablesorterPager(pagerOptions)
// bind to pager events
// *********************
.bind('pagerChange pagerComplete', function(e,c){
console.log(e);
console.log(c);
var msg = '" event triggered, ' + (e.type === 'pagerChange' ? 'going to' : 'now on') +
' page ' + (c.page + 1) + '/' + c.totalPages;
$('#display')
.append('<li>"' + e.type + msg + '</li>')
.find('li:first').remove();
});
lol 또한 tablesorter와 관련하여 몇 가지 문제가 있습니다. ':)' –
@CG 당신이 당신의 것을 고치기를 바랍니다. – Rooneyl
필터 위젯과 호출기 플러그인은 현재 호환되지 않습니다. 나는 다음 번 업데이트를 위해 작업 중이다. 그러나이 필터 위젯을 사용해 보라. https://github.com/jbritten/jquery-tablesorter-filter- 나는 페이저 플러그인과 함께 작동한다고 생각한다. – Mottie