【问题标题】:How to get output from custom component in slickgrid?如何从 slickgrid 中的自定义组件获取输出?
【发布时间】:2023-03-23 02:43:02
【问题描述】:

我有离子应用程序并在 slickgrid 中使用自定义组件。我可以从 slickgrid 向我的组件提供输入。但是我没有收到我的输出从我的组件发出到 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));
    }
} 

我通过这种方式在列定义中调用了上述方法

asyncPostRender: this.renderAngularComponent.bind(this)

这都是为组件提供输入。请指导在slickgrid组件中接收输出或回调的方式。

【问题讨论】:

    标签: angular slickgrid angular-slickgrid


    【解决方案1】:

    componentOutput.componentRef.instance 持有组件实例,因此您只需手动附加输出属性,例如如果有save

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-09
      • 1970-01-01
      • 2023-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-25
      • 1970-01-01
      相关资源
      最近更新 更多