带有服务器端过滤的tablesorter中的FilteredPages [英] FilteredPages in tablesorter with server-side filtering

查看:76
本文介绍了带有服务器端过滤的tablesorter中的FilteredPages的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用服务器端过滤时,我不确定如何在表排序器中更新 filteredPages 值.

I'm not sure how to update the filteredPages value in tablesorter when using server-side filtering.

我正在使用2.13.2版本,并且能够创建自定义的 output ,然后可以在 p.ajaxData 中对其进行访问,以便寻呼机显示正确数量的项目,等等(例如"30个中的1到10(共40个)".)但我看不到如何更改 select.gotoPage 的页面下拉菜单,以反映已过滤页面的减少.已经尝试过寻呼机小部件以及 tablesorterPager .

I am using version 2.13.2 and am able to create custom output which is then accessible in p.ajaxData so that the pager displays the correct number of items shown, etc (eg, "1 to 10 of 30 (40 total)". But I don't see how to change the page dropdown at select.gotoPage to reflect the reduced number of filtered pages. I've tried both the pager widget as well tablesorterPager.

例如,假设下拉菜单通常允许您选择第1页到第4页.现在您进行过滤,并且过滤后的项目适合3页-下拉菜单如何减少为仅显示3页作为选项?

For example, let's say the dropdown normally allows you to choose pages 1 through 4. Now you filter and the filtered items fit on 3 pages - how is the dropdown reduced to showing only 3 pages as options?

推荐答案

每次页面更改或表内容被过滤时,分页器选择下拉列表都会重新计算存在多少个页面(当对行进行过滤时).

The pager select dropdown recalculates how many pages exist (when rows are filters) each time the page is changed or the table content is filtered.

在这种情况下, filteredPages 应该是服务器提供给插件的信息,因为使用ajax时,传呼机自动默认为服务器端排序和过滤.确保将寻呼机的 ajaxUrl 选项更新为包括过滤器和排序参数.例如:

In this case, the filteredPages should be information that your server provides to the plugin because when using ajax, the pager automatically defaults to server side sorting and filtering. Make sure to update the pager's ajaxUrl option to include the filter and sort parameters. For example:

$(function(){
  $("table")
    .tablesorter()
    .tablesorterPager({
      ajaxUrl: "http://mydatabase.com?page={page}&size={size}&{sortList:col}&{filterList:fcol}",
      ajaxProcessing: function(ajax){
        // do something with the ajax
        return [ formatted_data, total_rows ];
      }
    });
  });
});

这篇关于带有服务器端过滤的tablesorter中的FilteredPages的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆