The following allows me to have the first available cell focused by default:
useEffect(() => {
if (
editMode &&
gridRef.current?.api &&
ppsColumns &&
ppsColumns.length > 0 &&
lastSelected === undefined
) {
const value = ppsColumns[0].field;
gridRef.current.api.setFocusedCell(0, value);
}
}, [editMode, gridRef.current]);
however, I would like to trigger a double click event instead of setting a focus state which enables the user to edit the cell immediately. Is there some sort of api that allows to do that?
2
Answers
You could modify your useEffect to start editing the first cell when your conditions are met:
I use setTimeout to work around timing issues, try adjust the delay duration (100 ms in the example)