Bootstrap-table:服务器端分页+ nextPage方法

时间:2017-11-15 18:50:33

标签: django bootstrap-table

我正在使用Django和应用程序Bootstrap-table来正确格式化我的表格。

我有很多数据,所以我使用的是服务器端分页。它工作得很好。

现在我想实现像nextPage方法一样的方法。

通过组合服务器端分页+方法nextPage的示例jsfiddle,它不起作用:单击按钮nextPage即使它绑定到nextPage方法也不会执行任何操作:

http://jsfiddle.net/ThePhi/msj2apLb/1/

<button id="button2" class="btn btn-default">nextPage</button>

<table data-toggle="table"
       data-url="http://issues.wenzhixin.net.cn/examples/bootstrap_table/data"
       data-pagination="true"
       data-side-pagination="server"
       data-page-list="[5, 10, 20, 50, 100, 200]"
       data-search="true"
       data-height="300">
    <thead>
    <tr>
        <th data-field="state" data-checkbox="true"></th>
        <th data-field="id" data-align="right" data-sortable="true">Item ID</th>
        <th data-field="name" data-align="center" data-sortable="true">Item Name</th>
        <th data-field="price" data-sortable="true">Item Price</th>
    </tr>
    </thead>
</table>
<script>
    var $table = $('#table'),

        $button2 = $('#button2');
    $(function () {

        $button2.click(function () {
            $table.bootstrapTable('nextPage');
        });

    });
</script>

1 个答案:

答案 0 :(得分:0)

我忘了放id="table" ...

工作jsFiddle:http://jsfiddle.net/ThePhi/msj2apLb/1/