【问题标题】:How could I add custom row focus class in ag-grid如何在 ag-grid 中添加自定义行焦点类
【发布时间】:2019-12-15 05:38:07
【问题描述】:

我想控制行焦点过程。我需要在表格中显示有关行焦点更改的确认对话框。

我尝试使用 rowClassRules 属性来执行此操作,但据我了解,功能在表格呈现时应用类,之后行类停止更改

rowClassRules = {
    'custom-row-focus': (params) => {
      return params.data.id === this.currentSelectedItem.id
    }
  }

当我点击该行时设置的 currentSelectedItem

【问题讨论】:

    标签: ag-grid ag-grid-ng2


    【解决方案1】:

    在文档中找到答案

    https://www.ag-grid.com/javascript-grid-row-styles/#refresh-of-styles

    如果你刷新一行,或者一个单元格由于编辑而更新,rowStyle、rowClass和rowClassRules都会被重新应用。

    所以,当我点击该行时,我应该这样做:

    onClicked($event: RowClickedEvent) {
        $event.node.setData({...$event.data});
    }
    

    【讨论】:

      猜你喜欢
      • 2016-08-04
      • 2020-03-21
      • 1970-01-01
      • 1970-01-01
      • 2016-11-06
      • 1970-01-01
      • 2020-05-06
      • 2018-04-28
      • 1970-01-01
      相关资源
      最近更新 更多