Search code examples
angularslickgridangular-slickgrid

How to get output from custom component in slickgrid?


I have ionic application and using the custom component in slickgrid. I can give input to my component from slickgrid. But I didn't receive my output emit from my component to slickgrid.

 renderAngularComponent(cellNode: HTMLElement, row: number, dataContext: any, colDef: Column) {
    if (colDef.params.component) {
        const componentOutput = this.angularUtilService.createAngularComponent(colDef.params.component);
        Object.assign(componentOutput.componentRef.instance, { selectedItem: dataContext, a: this.a, b: this.b });
        setTimeout(() => $(cellNode).empty().html(componentOutput.domElement));
    }
} 

I called the above mentioned method in the column definition by this way

asyncPostRender: this.renderAngularComponent.bind(this)

This is all about to providing input to the component.please guide the way to receive the output or callback in the slickgrid component.


Solution

  • componentOutput.componentRef.instance holds the component instance, so you just have to attach the output property manually, for example if there is save

    componentOutput.componentRef.instance.save.subscribe(()=>{console.log("method called");