如何在 bootstrap table 中更改页面大小的默认值?

How to change default value of page-size in bootstrap table?

我正在使用这个 bootstrap table http://wenzhixin.net.cn/p/bootstrap-table/docs/examples.html#client-side-pagination-table

默认页面大小为 10。如何在加载网格时将其更改为 5 或其他值。

它提供了选择它的选项 data-page-list="[5,10]" 但默认情况下在加载时它保持 10。

您可以使用 bootstrap table 的第 pageSize 属性 页赞

$('#table-javascript').bootstrapTable({
                cache: false,
                height: 400,
                striped: true,
                pagination: true,
                pageSize: 5, //specify 5 here
                pageList: [5, 10, 25, 50, 100, 200]//list can be specified here
});

阅读Docs

仅使用 html,使用 data-page-size=5http://jsfiddle.net/ThePhi/pamsqcea/

您可以在 table 标签中使用 data-page-size="PAGE_SIZE" 属性。 例如

<table class="table table-hover text-center" id="table" data-height="400" data-show-columns="true" data-toggle="table" data-search="true" data-show-export="true" data-pagination="true" data-click-to-select="true" data-toolbar="#toolbar" data-page-size="50" data-show-columns="true"> 
          <thead>
          </thead>
          <tbody>
          </tbody>
</table>