fix(fe): KsDataGrid - remove onCellFocused to allow Enter key navigation
Problem: onCellFocused was auto-starting edit mode on every focus, preventing AG Grid's native Enter-key navigation from working. Solution: Remove onCellFocused function and @cell-focused event handler. Now Enter key can properly navigate to next cell (Tab behavior). Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,8 +20,7 @@ import {
|
||||
type ColDef,
|
||||
type RowClickedEvent,
|
||||
type CellValueChangedEvent,
|
||||
type RowClassParams,
|
||||
type CellFocusedEvent
|
||||
type RowClassParams
|
||||
} from 'ag-grid-community'
|
||||
import type { UiGridColumn } from '../adapter/contracts'
|
||||
|
||||
@@ -113,26 +112,6 @@ function onCellValueChanged(event: CellValueChangedEvent): void {
|
||||
}
|
||||
}
|
||||
|
||||
function onCellFocused(event: CellFocusedEvent): void {
|
||||
if (event.column && event.rowIndex !== undefined) {
|
||||
const colDef = event.column.getColDef()
|
||||
if (colDef.editable) {
|
||||
const currentEditingCell = event.api.getEditingCell()
|
||||
const focusedColId = event.column.getColId()
|
||||
|
||||
const isSameCell = currentEditingCell &&
|
||||
currentEditingCell.rowIndex === event.rowIndex &&
|
||||
currentEditingCell.column?.getColId() === focusedColId
|
||||
|
||||
if (!isSameCell) {
|
||||
event.api.startEditingCell({
|
||||
rowIndex: event.rowIndex,
|
||||
colKey: focusedColId
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onSortChanged(params: { api: { redrawRows: () => void; refreshCells: (options: { force: boolean }) => void } }): void {
|
||||
params.api.redrawRows()
|
||||
@@ -208,7 +187,6 @@ defineExpose({ focusRow, redrawRows, gridApi })
|
||||
@sort-changed="onSortChanged"
|
||||
@row-clicked="onRowClicked"
|
||||
@cell-value-changed="onCellValueChanged"
|
||||
@cell-focused="onCellFocused"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user