本文介绍了cellClicked不要调用函数AgGrid Angular 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在单元格中单击并显示console.log,但是此功能无法运行:

I want do "click" in my cell and show console.log, but this function doesn't run:

  headerName: 'Id',
  field: 'id',
  cellClicked: function() {
          console.log('asssaasas');
  }

我确实在单元格中单击了AgGRID,但在html5.console中却没有t什么也没显示。...

I did click in my cell the AgGRID but in html5.console I don't show nothing....

推荐答案

似乎您要添加 cellClicked 列级别的事件-在 ColDef 之内。

Seems like you are adding cellClicked event at column level - within ColDef.

这种方式行不通。这是网格级别的事件。

It doesn't work that way. It's a grid level event.

<ag-grid-angular #agGrid class="ag-fresh"
   ..... 
    (cellClicked)="onCellClicked($event)"
   ....
 >
</ag-grid-angular>

在您的组件中,编写函数来处理此问题。

And within your component, write the function to handle this.

onCellClicked($event: CellClickedEvent) {
    console.log('asssaasas');
}

这篇关于cellClicked不要调用函数AgGrid Angular 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 03:15