在jQuery中分页数据表 [英] Paging data tables in jQuery

查看:88
本文介绍了在jQuery中分页数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张桌子,上面有五十个记录.我想在每页五个记录的页面中显示它们.我目前的方法使用jquery数据表,如下所示.

I have a table with more the fifty records in it. I want to display them in pages of five records per page. My current approach uses jquery datatables, as shown below.

$(document).ready(function () {
    var length = $('#data-datatable tbody tr').length;
    $('#data-datatable').dataTable({
        "bFilter": false,
        "bLengthChange": false,
        "iTotalDisplayRecords" : 5,
        "iTotalRecords":   length
    });
});

这将在一页中显示所有五十个记录!如何获得我想要的显示器?

This shows all fifty records in one page! How can I get the display I want please?

推荐答案

我对您的问题的假设:

  1. 您有一个html表,该表是从具有全部50行的上下文中填充的.
  2. 现在您要对这些元素进行分页.

在这里,我将展示一些方法:

Here, I'm going to show some approaches:

  1. 考虑 Django分页.您的上下文变量将进行分页.
  2. 使用 Django-datatable-view .它直接与jquery-datatable一起使用.
  1. Think about Django Pagination . You context variable will do the pagination.
  2. Use Django-datatable-view . It directly works with jquery-datatable.

这篇关于在jQuery中分页数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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