1、boostrapt table插件,表头与表题,resize时,不一致的解决办法
$(window).resize(function () {
$("#table").bootstrapTable('resetView');
});
2、选中表格某一行背景颜色变化
onClickRow: function (row, $element) {
$('.info').removeClass('info');
$($element).addClass('info');
}
3、表格初始化
$("#table").bootstrapTable({
method: "get",
url: "js/pages/charts/dataOil.json",
contentType: "application/x-www-form-urlencoded", //必须要有!!!!
// data: {},
pagination: true,
// search: true,
height: 436,
// sidePagination: "client",
pageNumber: 1,
pageSize: 10,
pageList: [10, 25, 50, 100],
// searchOnEnterKey: true,
// searchTimeOut: 500,
showFooter: false,
idField: "id",
uniqueId: "id",
sortOrder: "desc",
editable: false,
clickToSelect: true,
singleSelect: true, // 只能选中一条,false可以选中多条
cache: false,
// toolbar: "#toolbar",
striped: true,
responseHandler: function (res) {
var datetimeStart = $("#datetimeStart").val();
res.forEach(function (even) {
even.alarm_time = datetimeStart + even.alarm_time.substr(10, 9)
});
return res;
},
columns: [{
field: "id",
title: "序号",
align: "center",
visible: true,
},
{
field: "vin",
title: "车架号",
align: "center",
visible: true,
}, {
field: "licence",
title: "车牌号",
align: "center",
visible: true,
}, {
field: "type",
title: "车辆类型",
align: "center",
visible: true,
}, {
field: "device_id",
title: "终端号",
align: "center",
visible: true,
}, {
field: "kind",
title: "车辆种类",
align: "center",
visible: true,
},
{
field: "alarm_time",
title: "报警时间",
align: "center",
visible: true,
}
]
})