refactor: KsDataGrid - simplify focusRow and rely on AG Grid native Enter navigation

This commit is contained in:
2026-08-16 21:04:41 +09:00
parent 823312fd26
commit 8aad550c77
@@ -112,7 +112,6 @@ function onCellValueChanged(event: CellValueChangedEvent): void {
}
}
function onSortChanged(params: { api: { redrawRows: () => void; refreshCells: (options: { force: boolean }) => void } }): void {
params.api.redrawRows()
}
@@ -139,25 +138,15 @@ function onGridReady(params: GridReadyEvent): void {
params.api.sizeColumnsToFit()
}
function focusRow(rowIndex: number, colKey?: string): void {
if (!gridApi.value) return
const col = colKey || (props.columns[0]?.field ?? '')
const attempt = () => {
if (!gridApi.value) return
gridApi.value.ensureIndexVisible(rowIndex)
if (col) {
gridApi.value.setFocusedCell(rowIndex, col)
gridApi.value.startEditingCell({ rowIndex, colKey: col })
}
gridApi.value.ensureIndexVisible(rowIndex)
if (col) {
gridApi.value.setFocusedCell(rowIndex, col)
gridApi.value.startEditingCell({ rowIndex, colKey: col })
}
attempt()
setTimeout(attempt, 50)
setTimeout(attempt, 150)
}
function redrawRows(): void {