How to implement bootstrap-table to stay on the current page after data refresh
This article mainly shows you "bootstrap-table how to achieve data refresh to stay on the current page", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "bootstrap-table how to achieve data refresh to stay on the current page" this article.
Get the current page
To stay on the current page, we first need to get the current page. Bootstrap-table defines that getOptions can get a lot of table information, including the current page.
$table.bootstrapTable ('getOptions')
Re-request data
After we modify the data, we need to request the data again. We can use refresh or initialize the call again, which I use here to make the initialization call again. By passing the current page as a parameter.
Refresh data init (pageIndex) by calling initialization function Function init (pageIndex) {$('# table') .bootstrapTable ({method:'get', url:'/ admin/student/getAllStudent', striped:true, cache:false, uniqueId:'id', clickToSelect: true, pagination:true, / / set the paging pageNumber:pageIndex | | 1 Zero / initialize load the first page Default first page queryParams: the parameters passed by queryParams,// when requesting the server, number of sidePagination:'server', pageSize:10,// records per page, pageList: [10rec 20rep 30je 40], / / paging progress value columns: [{/ / column parameters field: 'sid', title:' sid',}, {field: 'name'] Title: 'name'}, {field:' grade', title: 'grade'}, {field:' password', title: 'password'}, {field:' Button', title: 'operation', events: operateEvents Add button to formatter:AddFunctionAlty// table},]}) } these are all the contents of the article "how to refresh the data in bootstrap-table and stay on the current page". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!