bootstrapTable 着色使用
干货
rowStyle: function (row, index) {
var strclass = "";
if (row.dataMode == "Y") {
var thisRow = row.id;
var targetRow = thisRow+":a";
var thisRow = $("#mDataTables").bootstrapTable('getRowByUniqueId', thisRow);
var targetRow = $("#mDataTables").bootstrapTable('getRowByUniqueId', targetRow);
if(checkAllData(thisRow,targetRow)){
strclass = "";
} else {
strclass = 'danger';
}
}
else {
return {};
}
return { classes: strclass }
}
/**
* 校验两行相同的两行数据是否匹配,匹配返回真,不匹配返回假
*/
function checkAllData(thisRow,targetRow) {
var result = false;
if(thisRow.loanCustomers == targetRow.loanCustomers
&&thisRow.loanAmountNumber == targetRow.loanAmountNumber
&&thisRow.cumulativeNumber == targetRow.cumulativeNumber
&&thisRow.loanAmounts == targetRow.loanAmounts
&&thisRow.cumulativeDischarge == targetRow.cumulativeDischarge
&&thisRow.loanBalance == targetRow.loanBalance
&&thisRow.loanBalanceNumber == targetRow.loanBalanceNumber
&&thisRow.singleMaximumAmount == targetRow.singleMaximumAmount
&&thisRow.averageRate == targetRow.averageRate
&&thisRow.validContracts == targetRow.validContracts){
result = true;
}
return result;
}