Setting Id in gridActions in ag-grid

Asked by At

I am creating the ag-grid gridActions:

protected gridActions = {
    'actions': [
        { 'name': 'OrderTracking', 'title': 'Order Tracking', 'icon': 'track_changes', 'onClick': (template) => { this.orderTracking(template); },'isVisible': (template) => { return !(template.status=="Cancelled") }},
        { 'name': 'Retry', 'title': 'Retry', 'icon': 'cached', 'onClick': (template) => { this.orderRetry(template); }, 'isVisible': (template) => { return template.hideRetry;}}
        // { 'name': 'cancel', 'title': 'Cancel', 'icon': 'cancel', 'onClick': (template) => { this.onCancelClick(); } }

    ]
};

I want to add id to both buttons, how can I do that. Please help

1 Answers

0
arun kumar On

Try the following way :

     public onCancelClick() {
        return (params) => {
            let idMapper = 'can-id-';
            return `<button data-action-type="cancel" class="btn" id="${idMapper + params.data.id}" >Cancel</button>

        };
    }