AG Grid中defaultColDef.cellClass中如何获取正在处理的cell的列索引

问题描述 投票:0回答:0

在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 '';
    }
  }, ...
typescript ag-grid ag-grid-angular
© www.soinside.com 2019 - 2024. All rights reserved.