在AG Grid社区中,在cellClass函数中——当它驻留在defaultColDef中时——我想知道正在处理的单元格的列索引。这有可能获得吗?我看到了下面的帖子,但即使我能让它工作(例如,我可以访问 cellClass 中的
colId
吗?我还没有看到它),它会增加很多处理来完成所有这些查找我们所有的 60 多个专栏:https://stackoverflow.com/a/64048964/442665
gridOptions: GridOptions = {
defaultColDef: {
cellClass: (params: CellClassParams) => {
// HOW CAN I KNOW THE COLUMN INDEX? I have 60+ columns in the grid
const idx = params.colDef.cellClass.columnIndex; // I would *LIKE* to do this
if (idx > 5){ // all cells after index = 5 are numeric
return ['ag-cell-align-right'];
}
return '';
}
}, ...