【问题标题】:Tabulator only shows one page, while there are 20+ pages制表器只显示一页,而有 20 多页
【发布时间】:2021-11-09 08:20:12
【问题描述】:

我正在使用 Tabulator 构建表格:

table = new Tabulator("#smartstat", {
    ajaxURL: "https://example.com/getsmartstat/" + date,
    pagination: "remote",
    paginationSize: 15,
    ajaxFiltering: true,
    ajaxParams: {_token: "{{ csrf_token() }}"},
    ajaxSorting: true,
    responsiveLayout: true,
    placeholder: "No Data Available",
    selectable: true,
    layout: "fitColumns",
    ajaxProgressiveLoadDelay: 2000,
    ajaxConfig: "get",
    ajaxResponse:function(url, params, response){
        return response.data; 
    },
    columns: [
        {title: "Shop", field: "shop", sorter: "string", headerSort: false},
        {
            title: "Total clicks",
            field: "click",
            sorter: "number",
            align: "center",
            formatter: "plaintext"
        },
        {title: "Plan", field: "plan", sorter: "string", formatter: "html"},
        {title: "Limit date", field: "limit_time", formatter: "html", align: "center"},
        {title: "Installation Date", field: "timestamp", sorter: "date", align: "center"},
    ],
});

我得到的回应似乎是正确的(缩短的例子):

{"last_page":23.266666666666666,"data":[{"shop":"shop1","click":100},{...}]}

所以tabulator明白一共有23页数据,但是渲染的时候看到的却是这样的表格分页:

因此只有第一页可用,其他页面的控件会自动禁用。我试图了解我做错了什么。

【问题讨论】:

    标签: javascript tabulator


    【解决方案1】:

    您的回复似乎有问题,

    last_page应该是整数,不能有23.266666666666666页的表数据

    【讨论】:

      【解决方案2】:

      问题是由于用于包含制表符的 URL 已设置为最新版本而引起的。因此,从 v2 到 v3 发生了意外更新,因此之前正常工作的代码在之后停止工作。为了解决这个问题,我手动回滚到 v2.x

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多