How to add click event on a cell in AgGrid

Discussão em 'Angular' iniciado por Tanzeel, Setembro 24, 2024.

  1. Tanzeel

    Tanzeel Guest

    I'm using AgGrid v28 with Angular 14. I've a very simple requirement. On click of details values I have to call a method.

    Screenshot: [​IMG]

    My code:

    columnDefs = [
    {...},
    {
    headerName: 'Details',
    field: 'partDescription',
    filter: false,
    minWidth: 50,
    cellRendererParams: {
    onClick: this.showPartsHierarchcy.bind(this),
    label: 'partDescription',
    icon: '',
    },
    },
    ]

    showPartsHierarchcy() {
    ...
    }


    The details column is populated but on click my method showPartsHierarchcy is not called. Please correct my mistake.

    I tried:

    This answer.

    cellRenderer: function(params: any) {
    return '<a (click)="showPartsHierarchcy">'+ params.value+'</a>'
    }


    No luck. Please help me.

    Continue reading...

Compartilhe esta Página