Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 0b257b5

Browse files
committed
fix focus
1 parent f3b3d8d commit 0b257b5

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

src/components/DefaultCell.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ export default function DefaultCell(
193193
return dirtyCell ? (
194194
<input
195195
value={(contextValue.value && contextValue.value.toString()) || ""}
196+
ref={editableMdRef}
196197
onChange={handleOnChange}
197198
onKeyDown={handleKeyDown}
198199
onBlur={handleOnBlur}

src/components/HeaderMenu.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,12 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
110110
setLabelStateInvalid(true);
111111
return;
112112
}
113-
114113
// Update state of ordered
115-
const updateOrderWithNewKey = table
116-
.getAllColumns()
117-
.map((o: any) => (o.id === column.id ? newKey : o.id));
114+
const updateOrderWithNewKey = table.options.state.columnOrder.map((o) =>
115+
o === column.id ? newKey : o
116+
);
118117
table.setColumnOrder(updateOrderWithNewKey);
119-
118+
// Update state of altered column
120119
setkeyState(newKey);
121120
alterColumnLabel(column.columnDef as TableColumn, labelState).then(() => {
122121
updateDataAfterLabelChange(

src/components/Table.tsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ export function Table(tableData: TableDataType) {
9494
const [columnOrder, setColumnOrder] = React.useState<ColumnOrderState>(
9595
columns.map((c) => c.id)
9696
);
97+
const findColumn = React.useCallback(
98+
(id: string) => {
99+
const findedColumn = columns.find((c) => c.id === id);
100+
return {
101+
findedColumn,
102+
index: columns.indexOf(findedColumn),
103+
};
104+
},
105+
[columns]
106+
);
97107
// Niveling number of columns
98108
if (columnOrder.length !== columns.length) {
99109
setColumnOrder(columns.map((c) => c.id));
@@ -247,17 +257,6 @@ export function Table(tableData: TableDataType) {
247257
current_row_template: settingsValue,
248258
});
249259
}
250-
251-
const findColumn = React.useCallback(
252-
(id: string) => {
253-
const findedColumn = columns.find((c) => c.id === id);
254-
return {
255-
findedColumn,
256-
index: columns.indexOf(findedColumn),
257-
};
258-
},
259-
[table.options.state.columnOrder]
260-
);
261260
LOGGER.debug(`<= Table`);
262261
return (
263262
<>

0 commit comments

Comments
 (0)