数据前台能查到,表格能显示,但是表格左下方数据总量显示 undefined,右下角无分页栏,就是没有“下一页,上一页”这些,控制台中 total 总数没问题,往前台传了,并且 onLoadSuccess 事件中能打印出来 totalRows (看了 bootstraptable 官网的属性说明,好像这个是显示数据总量的,我后台传上来的变量叫 total,它应该自动赋值了)
$("#table2").bootstrapTable({
method: 'POST',
contentType : "application/x-www-form-urlencoded",
// dataType: 'json',
url: "",
cache: false,
load: false,
toolbar : "#toolbar",
toolbarAlign: 'right',
clickToSelect: true,
sidePagination: "server",
pagination: true,
totalRows: 6,
pageNumber: 1,
pageSize: 2,
pageList: [1, 3],
smartDisplay: false,
onlyInfoPagination: false,
columns: getColumns(),
onLoadSuccess: function (jsonData) {
$("#table2").bootstrapTable('load', jsonData.list);
},
onLoadError: function () {
bootbox.alert("加载失败");
},
queryParams: function () {
var params = {
limit: this.limit,
offset: this.offset,
pageNumber: this.pageNumber,
pageSize: this.pageSize
};
return $.extend(params, queryParamsF());
}
});
前端接收到的数据
endRow: 2
hasNextPage: true
hasPreviousPage: false
isFirstPage: true
isLastPage: false
list: [{id: 1, bookName: "长安 1", author: "林德霍尔姆", price: 99.9, state: "可借", sid: 2,…},…]
0: {id: 1, bookName: "长安 1", author: "林德霍尔姆", price: 99.9, state: "可借", sid: 2,…}
1: {id: 2, bookName: "Java 虚拟机规范", author: "林德霍尔姆", price: 99.9, state: "不可接", sid: 2,…}
navigateFirstPage: 1
navigateLastPage: 3
navigatePages: 8
navigatepageNums: [1, 2, 3]
0: 1
1: 2
2: 3
nextPage: 2
pageNum: 1
pageSize: 2
pages: 3
prePage: 0
size: 2
startRow: 1
total: 6