随便说一说bootstrap-table插件

时间:2023-03-09 22:35:48
随便说一说bootstrap-table插件

如题、、、

bootstrap-table插件是一个js的表格插件

找了一下资料发现并没有多少

这里放一下初始化的语法

这里在html中写一个目标table元素

 <table id="reportTable">
</table>
 $('#reportTable').bootstrapTable({
method: 'post',
url: '/qStock/AjaxPage',
dataType: "json",
striped: true, //使表格带有条纹
pagination: true, //在表格底部显示分页工具栏
pageSize: 22,
pageNumber: 1,
pageList: [10, 20, 50, 100, 200, 500],
idField: "ProductId", //标识哪个字段为id主键
showToggle: false, //名片格式
cardView: false,//设置为True时显示名片(card)布局
showColumns: true, //显示隐藏列
showRefresh: true, //显示刷新按钮
singleSelect: true,//复选框只能选择一条记录
search: false,//是否显示右上角的搜索框
clickToSelect: true,//点击行即可选中单选/复选框
sidePagination: "server",//表格分页的位置
queryParams: queryParams, //参数
queryParamsType: "limit", //参数格式,发送标准的RESTFul类型的参数请求
toolbar: "#toolbar", //设置工具栏的Id或者class
columns: column, //列
silent: true, //刷新事件必须设置
formatLoadingMessage: function () {
return "请稍等,正在加载中...";
},
formatNoMatches: function () { //没有匹配的结果
return '无符合条件的记录';
},
onLoadError: function (data) {
$('#reportTable').bootstrapTable('removeAll');
},
onClickRow: function (row) {
window.location.href = "/qStock/qProInfo/" + row.ProductId;
},
});

嗯、、暂时用了这么多