tabulator.js表格分页查询

之前使用bootstrap table比较多,第一次使用tabulator,查了官方文档,一点一点debugger才整出来分页,记录一下。

使用的tabulator.js是 v3.5.1
html文件:

  <div id="demoTable"></div>

js文件:

("#demoTable").tabulator({
                pagination:"remote", //enable remote pagination
                ajaxConfig: "POST", //ajax request type
                ajaxURL:_ctx + '/view/getList', //set url for ajax request
                ajaxResponse:function(url, params, response){
                    //url - the URL of the request
                    //params - the parameters passed with the request
                    //response - the JSON object returned in the body of the response.
                    var data = {list:response};
                    return data; //return the tableData property of a response json object
                },
                paginationSize:5, //optional paramter to request a certain number of rows per page
                height : "100%",
                layout : "fitColumns",
                columnVertAlign : "bottom",
                tooltips : true,
                selectable : 1,
                movableColumns : false,
                columns : [
                    {title : "序号",field : "id",formatter : "rownum", width: 70, frozen : false,align : "center", headerSort : false,tooltipsHeader : false,tooltip : false},
                    {title : "名称 ",field : "name",sorter : "string",align : "center",editor : false,headerSort : false}
                ],
                langs:{
                    "ch-ch":{
                        "pagination":{
                            "first":"<<",
                            // "first_title":"<",
                            "last":">>",
                            // "last_title":">",
                            "prev":"<",
                            // "prev_title":"<",
                            "next":">",
                            // "next_title":">",
                        },
                    },
                },
            });
            $("#demoTable").tabulator("setLocale", "ch-ch");

java文件返回格式:

 Map result = new HashMap();
result.put("data",列表数据);
result.put("last_page",总页数);

分页栏展示效果如下图所示:

在这里插入图片描述
总体上来说,样式有点丑,官方文档还是英文的,网上的资料也不多,没有bootstrap使用起来方便。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值