如果配置metho为post,给后台传参时后台接收不到,最简单的解决办法是让后台改为get请求,前端传参时也能改只是比较麻烦。
还有,如果总记录条数小于pageSize时,即使设置了pagination为true分页条也不显示。
$("#dataTable").bootstrapTable({
url: "http://your-url.com",
method: 'get',
queryParams: function (params) {
return {
startTime: $('#startTime').val(),
endTime: $('#endTime').val(),
pageNum:params.pageSize,
currentPage: params.pageNumber
};
},
queryParamsType: '',
sidePagination: 'server',
pageSize: 10,
pagination: true,
pageList: [10, 20, 50, 100],
columns: [{
align: 'center',
field: 'rrtime',
title: '抽奖时间'
}, {
align: 'center',
field: 'openid',
title: 'OPENID'
}, {
align: 'center',
field: 'wechat_name',
title: '微信昵称',
sortable: true
}, {
width: '40px',
align: 'center',
field: 'head_url',
title: '头像',
formatter: function (v, row, index) {
return "<img style='width:80px;height:60px;' src='" + v + "'/>"
}
}, {
align: 'center',
field: 'orderid',
title: '订单号'
}, {
align: 'center',
field: 'phone',
title: '手机号'
},{
align: 'center',
field: 'draw_result',
title: '奖品',
formatter: function (v, row, index) {
var draw = "";
switch (v) {
case "1":
draw = "一等奖";
break;
case "2":
draw = "二等奖";
break;
case "3":
draw = "三等奖";
break;
case "4":
draw = "四等奖";
break;
case "5":
draw = "五等奖";
break;
default:
}
return "<span>" + draw + "</span>";
}
}]
});
网友评论