更改 table 行中的背景或 class

Change the background or class in table row

我用http://bootstrap-table.wenzhixin.net.cn/

需要一个示例来说明如何在自定义字段值

的函数中更改 table 行的 class

我用它来做单细胞

cellStyle: function(value){
                    if(value=='0'){
                        return { classes: 'success' };
                    }else{
                        return { classes: 'danger' };
                    }               
                },

我明白了

但我需要这个

提前致谢

rowStyle 函数中的第一个参数是当前行的数据对象。您可以简单地检查 Read 列中的输出 属性 和 return 需要 类.

function rowStyle(row, index) {

    if(row.Read = 100){ // possibly you map another property, it depends on your setting.

        return {classes : "neededClass" }
    }
    return {};
}

样本JS fiddle with test data