Tarsem Singh
Tarsem Singh

Reputation: 37

Ag-grid : Cell Editors Aginit get called twice

enter image description hereFramework : Angular6+ and Ag Grid Api

I have CellEditorcomponent which implement AgEditorComponent and upon key press, I am starting edit with agApi.startEditingCells(params) and Aginit() is executed for CellEditorComponent

this CellEditingStartedEvent is listen and a server call is made and based on response allow Editing. in order to make sure that user does not focus out from cell, I have re-called that agApi.startEditingCells(params) for same "Column and rowIndex with charpress, keyPress" but CellEditorComponent get destroyed and re-created again. I have following : 1) How I can prevent agGridApi.StartEditingCell() from calling AgInit() of CellEditor twice. 2) is calling StartEditingCell() from same col and row index will re-created cellEditorcomponent?

Upvotes: 0

Views: 2328

Answers (1)

GreyBeardedGeek
GreyBeardedGeek

Reputation: 30088

If I understand correctly, you are calling startEditingCells from your CellEditorComponent. You shouldn't do that, because if your CellEditorComponent is active, then you are already editing. Calling startEditingCells is probably causing the grid to destroy your CellEditorComponent and create a new one, hence the multiple invocations of agInit

startEditingCells is meant for manually triggering editing from outside of the grid (usually from the grid's parent component).

Upvotes: 2

Related Questions