BootstrapTable coloring usage

BootstrapTable coloring usage

Dry goods

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;
}

Guess you like

Origin blog.csdn.net/ampsycho/article/details/78788904