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 ?? '')
|
const col = colKey || (props.columns[0]?.field ?? '')
|
||||||
|
|
||||||
gridApi.value.ensureIndexVisible(rowIndex)
|
gridApi.value.ensureIndexVisible(rowIndex)
|
||||||
gridApi.value.setFocusedCell(rowIndex, col)
|
|
||||||
|
|
||||||
if (col) {
|
const attempt = () => {
|
||||||
setTimeout(() => {
|
if (!gridApi.value) return
|
||||||
gridApi.value?.startEditingCell({ rowIndex, colKey: col })
|
gridApi.value.setFocusedCell(rowIndex, col)
|
||||||
}, 0)
|
gridApi.value.startEditingCell({ rowIndex, colKey: col })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
attempt()
|
||||||
|
setTimeout(attempt, 10)
|
||||||
|
setTimeout(attempt, 50)
|
||||||
}
|
}
|
||||||
|
|
||||||
function redrawRows(): void {
|
function redrawRows(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user