fix: KsDataGrid - ensure edit mode starts after focusing and Enter key navigation
- Add setTimeout in focusRow to ensure DOM updates before startEditingCell - Add startEditingCell after tabToNextCell in Enter key handler - Ensures smooth edit mode transition: focus → edit mode immediately
This commit is contained in:
@@ -117,6 +117,13 @@ function onCellKeyDown(event: any): void {
|
||||
event.event.preventDefault()
|
||||
event.api.stopEditing(false)
|
||||
event.api.tabToNextCell(false)
|
||||
|
||||
setTimeout(() => {
|
||||
const focusedCell = event.api.getFocusedCell()
|
||||
if (focusedCell && focusedCell.rowIndex !== null) {
|
||||
event.api.startEditingCell({ rowIndex: focusedCell.rowIndex, colKey: focusedCell.column.getColId() })
|
||||
}
|
||||
}, 0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,8 +159,11 @@ function focusRow(rowIndex: number, colKey?: string): void {
|
||||
|
||||
gridApi.value.ensureIndexVisible(rowIndex)
|
||||
gridApi.value.setFocusedCell(rowIndex, col)
|
||||
|
||||
if (col) {
|
||||
gridApi.value.startEditingCell({ rowIndex, colKey: col })
|
||||
setTimeout(() => {
|
||||
gridApi.value?.startEditingCell({ rowIndex, colKey: col })
|
||||
}, 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user