【问题标题】:How to add background on ag grid pinnedBottomRowData using rowClass in aggrid angular如何使用 ag 网格角度中的行类在 ag 网格 pinnedBottomRowData 上添加背景
【发布时间】:2020-03-19 02:56:48
【问题描述】:

如何在pinnedBottomRowData整个底行添加背景

这是代码

list.component.ts

  columnDefs = new Array();
  rowData = new Array();
  pinnedBottomRowData: any;
ngOnInit() {
this.columnDefs = [
      {
        'headerName': 'Style/Machine',
        'field': 'total',
      }
    ];
    for (let i = 1; i < 30; i++) {
      this.rowData.push(
        {
          'total': 'Machine ' + i
        }
      );
    }
    this.pinnedBottomRowData = this.createData(1);
}

  createData(count: number) {
    const result = [];
    for (let i = 0; i < count; i++) {
      result.push({
        total: 'Total Machine'
      },
        {
          total: 'Total',
        });
    }
    return result;
  }

这是输出

【问题讨论】:

    标签: javascript angular ag-grid ag-grid-angular


    【解决方案1】:

    您可以使用getRowStyle 并检查该行是否固定在底部。请参考以下示例。

    this.getRowStyle = function(params) {
          if (params.node.rowPinned === 'bottom') {
            return { "background-color": "blue" };
          }
        };
        this.pinnedBottomRowData = createData(1, "Bottom");
    

    Plunker

    参考link

    【讨论】:

      猜你喜欢
      • 2020-07-19
      • 2019-07-28
      • 2021-01-15
      • 2019-02-14
      • 1970-01-01
      • 2021-09-23
      • 2020-10-05
      • 2020-03-22
      • 2020-12-14
      相关资源
      最近更新 更多