如何在 Handsontable 上进行条件格式化?
How to do conditional formatting on Handsontable?
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;
}
我可以使用这个回调,这让我可以处理单元格格式。
如果有遇到此类问题的访问者,请询问。
谢谢
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;
}
我可以使用这个回调,这让我可以处理单元格格式。 如果有遇到此类问题的访问者,请询问。 谢谢