user1298426 user1298426 - 4 months ago 61
jQuery Question

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

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.

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