ag-Grid:以编程方式进入编辑模式

ag-Grid : enter edit mode programmatically

我有一个 singleClickEdit 设置为 true 的网格。

我想在网格完成加载或用户完成编辑一行时进入编辑模式。 我试过 API setFocusedCell(rowIndex, colKey, floating) 但它只是聚焦单元格而没有输入编辑。 目标是建立快速编辑网格,从不使用鼠标...

有办法吗?

提前致谢!

您可以使用 gridReady/onGridReady 回调获取对 grid 的引用,然后在 grid.api 上调用 startEditingCell 函数。

grid.api.startEditingCell(params): Starts editing the provided cell. If another cell is editing, the editing will be stopped in that other cell.

Parameters are as follows:
rowIndex: The row index of the row to start editing.
colKey: The column key of the column to start editing.
keyPress, charPress: The keyPress and charPress that are passed to the cellEditor