bootstrapTable 着色使用

来源:互联网 发布:centos ifconfig 编辑:程序博客网 时间:2024/06/05 14:55

bootstrapTable 着色使用

干货

rowStyle: function (row, index) {    //这里有5个取值代表5中颜色['active', 'success', 'info', 'warning', 'danger'];    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;}