在 ajaxProcessing 之后更新寻呼机中的 totalRows
Updating totalRows in pager after ajaxProcessing
我正在使用带有外部 ajaxProcessing 调用的 tablesorter 构建我的 table。
我的寻呼机输出显示 filteredRows 和 totalRows
.tablesorterPager({
output: '{startRow} - {endRow} / {filteredRows} filtered ({totalRows} total) ',
ajaxUrl:"{% url 'stats_json' %}{page}?{filterList:filter}&{sortList:column}&pagesize={size}",
}
我在 ajaxProcessing
中返回 table 行和筛选行数:
ajaxProcessing: function(data){
var rows=[];
....
rows.push(row);
return [data.filtered_rows_no,rows];
}
过滤后,我的filteredRows
总是和totalRows
一样,但应该是不同的。
我应该如何更新 totalRows
?
当 return 从 ajaxProcessing
函数中输入额外值时,不要 return 数组。相反,return 一个包含总计、筛选行和任何额外值的对象,如下所示 (ref):
return {
total: data.total_rows_no,
filteredRows: data.filtered_rows_no,
rows: rows // array of arrays
};
对于 total
,我猜测该值包含在 data.total_rows_no
中,因为我认为实际总数不等于 rows.length
值。
我正在使用带有外部 ajaxProcessing 调用的 tablesorter 构建我的 table。
我的寻呼机输出显示 filteredRows 和 totalRows
.tablesorterPager({
output: '{startRow} - {endRow} / {filteredRows} filtered ({totalRows} total) ',
ajaxUrl:"{% url 'stats_json' %}{page}?{filterList:filter}&{sortList:column}&pagesize={size}",
}
我在 ajaxProcessing
中返回 table 行和筛选行数:
ajaxProcessing: function(data){
var rows=[];
....
rows.push(row);
return [data.filtered_rows_no,rows];
}
过滤后,我的filteredRows
总是和totalRows
一样,但应该是不同的。
我应该如何更新 totalRows
?
当 return 从 ajaxProcessing
函数中输入额外值时,不要 return 数组。相反,return 一个包含总计、筛选行和任何额外值的对象,如下所示 (ref):
return {
total: data.total_rows_no,
filteredRows: data.filtered_rows_no,
rows: rows // array of arrays
};
对于 total
,我猜测该值包含在 data.total_rows_no
中,因为我认为实际总数不等于 rows.length
值。