我有离子型应用程序,并且在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组件中接收输出或回调的方法。
[componentOutput.componentRef.instance
保存组件实例,所以您只需要手动附加输出属性,例如,如果有save
componentOutput.componentRef.instance.save.subscribe(()=>{console.log("method called");