【发布时间】:2015-03-25 06:21:05
【问题描述】:
问题:我可以更改单元格的背景颜色,但不能更改标题的背景颜色。我可以更改 Handsontable 中标题的背景颜色和字体颜色吗?
【问题讨论】:
标签: handsontable
问题:我可以更改单元格的背景颜色,但不能更改标题的背景颜色。我可以更改 Handsontable 中标题的背景颜色和字体颜色吗?
【问题讨论】:
标签: handsontable
您可以为此使用 jquery 或 css。比如给所有的span.colHeader应用一个背景色:
.handsontable span.colHeader {
text-color: #B2B2FF; /* pink ish */
background-color: #FF7878; /* red */
}
或者更简单,handsontable 允许将 HTML 用于 col 标头,因此作为一个选项,您可以提供带有 HTML 的标头数组:
hot = new Handsontable(container, {
data: items,
startRows: 1,
colHeaders: ['<label id="header1" style="background-color: blue">I'm the first header"</label>', '<label id="header2" style="background-color: red">I'm the second header"</label>']
}
)
【讨论】:
在文档头部添加样式标签。这将影响页面上的所有 HOT 网格。 仍在研究如何使不同的网格以不同的样式显示。
.handsontable table thead th{
background-color: green;
color:white;
font-weight:bold;
font-size:12px;
}
【讨论】:
<div class="divHot1"><div id="divHOTTable">... 在你的 CSS 中,选择使用 div.divHot1 .handsontable table thead th
测试这个css来改变handsontable标题颜色
.handsontable th {color: #f5ffa5 !important; background: #78DEFF !important; }
【讨论】: