Twitter bootstrap 细胞颜色-温致新';s引导表(或备选方案)
我使用wenzhixin的引导表已经有一段时间了,效果非常好,现在我需要根据不同的阈值对每个单元格进行着色,我想通过ajax返回单元格值和单元格颜色,这样我就可以完成调用中的所有过程。 我正在加载表格,如下所示:Twitter bootstrap 细胞颜色-温致新';s引导表(或备选方案),twitter-bootstrap,bootstrap-4,bootstrap-table,Twitter Bootstrap,Bootstrap 4,Bootstrap Table,我使用wenzhixin的引导表已经有一段时间了,效果非常好,现在我需要根据不同的阈值对每个单元格进行着色,我想通过ajax返回单元格值和单元格颜色,这样我就可以完成调用中的所有过程。 我正在加载表格,如下所示: if (data) { $('#estado').bootstrapTable('removeAll'); $('#estado').bootstrapTable('load', data); } 你建议如何解决这个问题,也许我不应该用文之心bt来解决这个问题 我看到
if (data) {
$('#estado').bootstrapTable('removeAll');
$('#estado').bootstrapTable('load', data);
}
你建议如何解决这个问题,也许我不应该用文之心bt来解决这个问题
我看到了另一个答案,但为了使用它们,我应该添加一个额外的列,其中包含下一个应该具有的值,然后通过js对其进行着色,这是最好的方法吗?
谢谢大家! 引导表应该能够处理您想要的内容。基于单元的样式有三个选项:
function rowStyle(row, index) {
return {
classes: 'text-nowrap another-class',
css: {"color": "blue", "font-size": "50px"}
};
}
function cellStyle(value, row, index, field) {
return {
classes: 'text-nowrap another-class',
css: {"color": "blue", "font-size": "50px"}
};
}
function rowStyle(row, index) {
return {
classes: 'text-nowrap another-class',
css: {"color": "blue", "font-size": "50px"}
};
}
function cellStyle(value, row, index, field) {
return {
classes: 'text-nowrap another-class',
css: {"color": "blue", "font-size": "50px"}
};
}
请参阅完整示例function priceFormatter(value) {
// 16777215 == ffffff in decimal
var color = '#'+Math.floor(Math.random() * 6777215).toString(16);
return '<div style="color: ' + color + '">' +
'<i class="glyphicon glyphicon-usd"></i>' +
value.substring(1) +
'</div>';
}
函数价格格式化程序(值){
//16777215==十进制FFFF
var color='#'+Math.floor(Math.random()*6777215).toString(16);
返回“”+
'' +
值。子字符串(1)+
'';
}
请参阅完整示例引导表应该能够处理您想要的内容。基于单元的样式有三个选项:
function rowStyle(row, index) {
return {
classes: 'text-nowrap another-class',
css: {"color": "blue", "font-size": "50px"}
};
}
function cellStyle(value, row, index, field) {
return {
classes: 'text-nowrap another-class',
css: {"color": "blue", "font-size": "50px"}
};
}
function rowStyle(row, index) {
return {
classes: 'text-nowrap another-class',
css: {"color": "blue", "font-size": "50px"}
};
}
function cellStyle(value, row, index, field) {
return {
classes: 'text-nowrap another-class',
css: {"color": "blue", "font-size": "50px"}
};
}
请参阅完整示例function priceFormatter(value) {
// 16777215 == ffffff in decimal
var color = '#'+Math.floor(Math.random() * 6777215).toString(16);
return '<div style="color: ' + color + '">' +
'<i class="glyphicon glyphicon-usd"></i>' +
value.substring(1) +
'</div>';
}
函数价格格式化程序(值){
//16777215==十进制FFFF
var color='#'+Math.floor(Math.random()*6777215).toString(16);
返回“”+
'' +
值。子字符串(1)+
'';
}
请参阅完整示例你所说的“不同阈值”是什么意思?例如:如果client_id=1和salesSo,假设你每行有3个值:
client_id
,sales
,例如sales_target
,颜色取决于sales
和sales_target
之间的关系。你说得对吗“不同的门槛“?例如:如果client_id=1且salesSo,假设您每行有3个值:client_id
,sales
,例如sales\u target
,颜色取决于sales
和sales\u target
我说得对吗?@Alejandro,这个答案有用吗?@Alejandro,这个答案有用吗?”?