gables20
gables20

Reputation: 496

how to make custom cell editor interact with custom cell renderer

I have created a custom cell editor and a custom cell renderer. I want the renderer to display a flag when there is a validation error in the cell Editor. At the point of checking if the entered text is empty, showIcon becomes true in the editor. But this is not reflected in the renderer. I have tried to force a refresh, and the showIcon flag remains false. What is the best way to achieve this?

export class TextEditorComponent implements  ICellEditorComp {
    ...
    isCancelAfterEnd(): boolean {
        if(this.isEmpty(this.text)) {
            this.params.showIcon = true;
            this.params?.api.refreshCells({ columns: ['showIcon'] });
            return true;
        }
        return false;
    }
    ...
}

{
    colId: "icon",
    cellRenderer: "IconRendererComponent",
    width: 70,
    cellRendererParams: {
        showIcon: false
    }
}

export class IconRendererComponent implements ICellRendererAngularComp {
    ...
    agInit(params: ICellRendererParams): void {
        this.params = params;
        this.showIcon = this.params.showIcon;
    }
}

Upvotes: 0

Views: 79

Answers (0)

Related Questions