Open
Description
By default, paginationjs appends pageSize and pageNumber to the request url, but my backend api only accepts post requests and needs to place these two parameters in the body.
I tried to use beforePaging to obtain pageNumber and modify the data in ajax's beforeSend, but beforePaging is triggered after beforeSend, the page can only be turned to the last page number each time.
May I ask if there is a solution.
let queryData = {
//...
pageSize: 10,
pageNumber: 1,
};
let url = "http://api/page";
$("#demo").pagination({
// api 的 url
dataSource: url,
ajax: {
beforeSend: function (e,settings) {
console.log("beforeSend");
settings.data=JSON.stringify(queryData);
},
type: "POST",
data: {},
...
},
callback: function (data, pagination) {
//dataContainer.empty();
console.log(data);
$tableData.bootstrapTable(’refreshOptions',{ data: data });
},
beforePaging: function (pageNum) {
console.log("beforePaging");
queryData.pageNumber = pageNum;
},
//...
});
Metadata
Metadata
Assignees
Labels
No labels