0

I have added a column with custom renderer like this,

settings = {
   actions: false,
   columns: {
      operation:{
         title:"operation",
         type: 'custom',
         renderComponent: CustomActionRenderComponent,
      }
}

and now it looks like this : enter image description here

I want to fire the default edit or delete action when user clicks on link in dropdown. Basically I want to call the same function which are invoked when default action column is enabled and links in that column are clicked.

NoobSaibot
  • 204
  • 1
  • 2
  • 10

1 Answers1

0

I tried calling default functions of ng2-smart table, but could not achieve in doing so.

So i used OnComponentInitFunction() for emitting actions from renderComponent.

Below is the sample code:

 {
title: "Actions",
type: "custom",
  renderComponent: ActionRenderComponent,
    onComponentInitFunction:(instance) => {
      instance.actionEmitter.subscribe(row => {
        if (row == 'Edit') {
          //invoke your methods here
        }
        if (row == 'delete') {
          //invoke your methods here      
        });
    },
      filter: false
  }
};

As you can see above actionEmitter is the emitter from renderComponent

Srinivas Valekar
  • 1,083
  • 10
  • 19