gpt4 book ai didi

javascript - 更改表格行中的背景或类别

转载 作者:行者123 更新时间:2023-11-28 18:55:09 25 4
gpt4 key购买 nike

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

需要一个示例来说明如何在自定义字段值的函数中更改表行的类

我用它来处理单细胞

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

我明白了 enter image description here

但我需要这个 enter image description here

提前致谢

最佳答案

rowStyle 函数中的第一个参数是当前行的数据对象。您可以在Read列中简单地检查该输出的属性并返回所需的类。

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

关于javascript - 更改表格行中的背景或类别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33751908/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com