首页 > 解决方案 > 滚动移动时,Ag-grid 在整个列中复制 CellStyle

问题描述

我有以下代码:

const cell = vm.gridOptionsFib.api.setFocusedCell(index, field, null);
const cellFoc = vm.gridOptionsFib.api.getFocusedCell();
const rowNodeCell = vm.gridOptionsFib.api.getRowNode(cellFoc.rowIndex);
const column = cellFoc.column.colDef.field;               
cellFoc.column.colDef.cellStyle = { 'backgroundColor': 'rgba(233, 30, 99, 0.3)' };
vm.errGrid = "mensaje tooltip";
cellFoc.column.colDef.tooltipValueGetter = function() {return vm.errGrid;};
vm.gridOptionsFib.api.refreshCells({force: true, columns: [column], rowNodes: [rowNodeCell]});
vm.gridOptionsFib.api.clearFocusedCell();

这很好用并标记了我指定的单元格,当我移动水平滚动条时出现问题,当我返回指定的列时,它会在我只指定一个时绘制所有单元格。

有谁知道它为什么这样做或者我需要一些指导。

标签: javascriptag-grid

解决方案


如果有人遇到同样的问题,应用的解决方案是在 gridOptions 中设置以下属性。

suppressColumnVirtualisation: true,
rowBuffer: 9999,

推荐阅读