EduBw
EduBw

Reputation: 942

cellClicked don't call function AgGrid Angular 2

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');
  }

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

Upvotes: 0

Views: 4840

Answers (1)

Paritosh
Paritosh

Reputation: 11560

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');
}

Upvotes: 5

Related Questions