bootstrapTable改变列、⾏颜⾊1.改变列颜⾊
{
title: '运单编号',
field: 'waybillNumber',
align: 'center',
valign: 'middle',
cellStyle: function (value, row, index) {
if (row.focusMark == "0") {
return {css: {"background-color": "red"}};
}
记住我
if (dinateMark == "1") {
return {css: {"background-color": "#cb7f71"}};
}
if (dinateMark == "2") {
return {css: {"background-color": "#71cbb9"}};
}
return '';
}
}
2.改变⾏颜⾊
$("#table").bootstrapTable({
url: dataurl,
method: "post",
dataType: "json",
//......
onLoadSuccess: function (row) {
getTdValue(row);
}
});
//当远程数据加载完成后触发
function getTdValue(row) {
var tableId = ElementById("table");
var y = 0;
for (var i = 0; i < ws.length; i++) {
//将已标记的数据改变背景颜⾊
y++;
if (ws[i].coordinateMark == "1") {
}
if (ws[i].coordinateMark == "2") {
}
if (ws[i].focusMark == "0") {
}
if (ws[i].focusMark == "2") {
}
}
}