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

24.5k views Asked by At

I am using this bootstrap table http://wenzhixin.net.cn/p/bootstrap-table/docs/examples.html#client-side-pagination-table

which gives default page-size of 10. How can I change it to 5 or anything when the grid is loaded.

It gives option of selecting it data-page-list="[5,10]" but by default on load it keeps it 10.

3

There are 3 answers

3
Guruprasad J Rao On BEST ANSWER

You can use page pageSize property of bootstrap table like

$('#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
});

Read Docs

0
Hitesh Vyas On

You can use data-page-size="PAGE_SIZE" attribute in table tag. for eg.

<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>

0
ThePhi On

with html only, use data-page-size=5 : http://jsfiddle.net/ThePhi/pamsqcea/