如何高亮选中的行和handsontable的header?
How to highlight the selected row and header of handsontable?
作为一项要求,我想突出显示 handsontable 中选定单元格的行和列 header,基本上我想在单击单元格时更改相应 header 的背景颜色。
Handsontable 已内置 属性,单击单元格可突出显示整行
var
data = [
['', 'Kia', 'Nissan', 'Toyota', 'Honda'],
['2013', 10, 11, 12, 13],
['2014', 20, 11, 14, 13],
['2015', 30, 15, 12, 13]
],
container = document.getElementById('example1'),
hot;
hot = Handsontable(container, {
data: data,
minRows: 5,
minCols: 6,
currentRowClassName: 'currentRow',
currentColClassName: 'currentCol',
rowHeaders: true,
colHeaders: true
});
hot.selectCell(2,2);
但我只想通过更改其背景颜色来突出显示 headers,有什么方法可以使用自定义渲染器实现它吗?
将示例中的 CSS 代码从 .highlight { … }
更改为 th.highlight { … }
应该可以解决问题。最后 table headers 在 Handsontable 中只是元素。
作为一项要求,我想突出显示 handsontable 中选定单元格的行和列 header,基本上我想在单击单元格时更改相应 header 的背景颜色。
Handsontable 已内置 属性,单击单元格可突出显示整行
var
data = [
['', 'Kia', 'Nissan', 'Toyota', 'Honda'],
['2013', 10, 11, 12, 13],
['2014', 20, 11, 14, 13],
['2015', 30, 15, 12, 13]
],
container = document.getElementById('example1'),
hot;
hot = Handsontable(container, {
data: data,
minRows: 5,
minCols: 6,
currentRowClassName: 'currentRow',
currentColClassName: 'currentCol',
rowHeaders: true,
colHeaders: true
});
hot.selectCell(2,2);
但我只想通过更改其背景颜色来突出显示 headers,有什么方法可以使用自定义渲染器实现它吗?
将示例中的 CSS 代码从 .highlight { … }
更改为 th.highlight { … }
应该可以解决问题。最后 table headers 在 Handsontable 中只是元素。