Javascript 当使用handsontable.js时,滚动页面上的CSS会发生变化
我在网页上使用一个可触摸的手机Javascript 当使用handsontable.js时,滚动页面上的CSS会发生变化,javascript,excel,web,render,handsontable,Javascript,Excel,Web,Render,Handsontable,我在网页上使用一个可触摸的手机 var hot = new Handsontable(container, { data: datatable, colHeaders: true, rowHeaders: true, width: 600, licenseKey: "non-commerc
var hot = new Handsontable(container, {
data: datatable,
colHeaders: true,
rowHeaders: true,
width: 600,
licenseKey: "non-commercial-and-evaluation",
});
现在我想通过改变一些单元格的背景色来动态高亮显示它。像这样:
var dataElements = document.querySelectorAll('.handsontable td');
if (row_attr == "ALL") {
for (var k = row * numberOfCols; k < (row + 1) * numberOfCols; k++) {
dataElements[k].style.backgroundColor = color;
}
}
var-dataElements=document.querySelectorAll('.handsontable-td');
如果(行属性=“全部”){
对于(变量k=行*numberOfCols;k<(行+1)*numberOfCols;k++){
数据元素[k].style.backgroundColor=color;
}
}
Thia工作正常,但如果在页面上向下滚动,并返回到该单元格,则该单元格不再着色
有人熟悉handsontable.js吗
我猜表格会动态地呈现表格中显示的部分,但我不确定。Handsontable会在滚动时重新呈现每个单元格。使用自定义渲染器在滚动时保持样式。请参阅:当您滚动时,Handsontable将重新渲染每个单元格。使用自定义渲染器在滚动时保持样式。见: