【问题标题】:Get selected rows by checkbox selection?通过复选框选择获取选定的行?
【发布时间】:2020-02-03 10:34:57
【问题描述】:

在我的列定义中,我有这个:

 {
        headerName: 'All',
        field: 'all',
        headerCheckboxSelection: true,
        headerCheckboxSelectionFilteredOnly: true,
        checkboxSelection: true,
        width: 40,
        maxWidth: 40,
        suppressFilter: true,
        cellStyle: params => {

          return { textAlign: 'center' }

        }
      },

但是当我通过复选框进行选择时,我没有得到选定的行。有什么建议可以做到这一点,以使通过复选框进行选择与行选择相同?

我在 ag 网格文档中使用这个: https://www.ag-grid.com/javascript-grid-selection/

【问题讨论】:

  • 试试 gridApi.getSelectedRows()
  • 但是当用户点击复选框时如何触发该事件?每次点击复选框时,我都需要抓住它并用它做一些事情
  • 尝试网格回调事件 - (rowSelected)="rowSelected()"。参考 - ag-grid.com/javascript-grid-events
  • 就是这样... tnx :)

标签: angular ag-grid


【解决方案1】:

来自 ag-grid Grid Events API

rowSelected 行被选中或取消选中。

给出的例子:

(rowSelected)="rowSelected()"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-13
    • 1970-01-01
    • 1970-01-01
    • 2019-11-01
    • 2018-10-11
    相关资源
    最近更新 更多