gpt4 book ai didi

javascript - 如何在 Handsontable 上进行条件格式化?

转载 作者:行者123 更新时间:2023-11-30 21:02:18 26 4
gpt4 key购买 nike

var data = [
["", "Tesla", "Volvo", "Toyota", "Honda"],
["2017", 10, 11, 12, 13],
["2018", 20, 11, 14, 13],
["2019", 30, 15, 12, 13]
];

var container = document.getElementById('example');
var hot = new Handsontable(container, {
data: data,
rowHeaders: true,
colHeaders: true
});

这是 Handsontable 示例。我想更改第一行文本格式。例如粗体

我认为 cells 回调函数会有所帮助,但我不确定参数是什么以及如何使用它。

cells: function (row, col, prop) {
var cellProperties = {};
if (row === 0) {
cellProperties.renderer = function () {
...
}
}
}

谢谢。

最佳答案

cells: function(td, row, col, prop) {
var cellProperties = {};
if (row > 0 && col > 0) {
cellProperties.type = 'numeric',
cellProperties.format = '0,0.00 $';
cellProperties.renderer = celulasBold;
}
return cellProperties;
}

我可以使用这个回调,这让我可以处理单元格格式。如果有遇到此类问题的访问者,请询问。谢谢。

关于javascript - 如何在 Handsontable 上进行条件格式化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47022053/

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