fix: KsDataGrid - improve focusRow edit mode reliability with retry logic
- Use multiple setTimeout attempts to ensure startEditingCell succeeds - Retry at 10ms and 50ms intervals for DOM/Grid stability - Addresses issue where keyboard input not available after focusRow
This commit is contained in:
@@ -158,13 +158,16 @@ function focusRow(rowIndex: number, colKey?: string): void {
|
||||
const col = colKey || (props.columns[0]?.field ?? '')
|
||||
|
||||
gridApi.value.ensureIndexVisible(rowIndex)
|
||||
gridApi.value.setFocusedCell(rowIndex, col)
|
||||
|
||||
if (col) {
|
||||
setTimeout(() => {
|
||||
gridApi.value?.startEditingCell({ rowIndex, colKey: col })
|
||||
}, 0)
|
||||
const attempt = () => {
|
||||
if (!gridApi.value) return
|
||||
gridApi.value.setFocusedCell(rowIndex, col)
|
||||
gridApi.value.startEditingCell({ rowIndex, colKey: col })
|
||||
}
|
||||
|
||||
attempt()
|
||||
setTimeout(attempt, 10)
|
||||
setTimeout(attempt, 50)
|
||||
}
|
||||
|
||||
function redrawRows(): void {
|
||||
|
||||
Reference in New Issue
Block a user