Skip to content

Commit ac4c74d

Browse files
committed
Fix for frontend turning column names as integers into strings
Signed-off-by: martinRenou <[email protected]>
1 parent f1f8b15 commit ac4c74d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

ipydatagrid/datagrid.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,15 +433,17 @@ def __init__(self, dataframe, index_name=None, **kwargs):
433433
def __handle_custom_msg(self, _, content, buffers): # noqa: U101,U100
434434
if content["event_type"] == "cell-changed":
435435
row = content["row"]
436-
column = content["column"]
436+
column = self._column_index_to_name(
437+
self._data, content["column_index"]
438+
)
437439
value = content["value"]
438440
# update data on kernel
439441
self._data["data"].loc[row, column] = value
440442
# notify python listeners
441443
self._cell_change_handlers(
442444
{
443445
"row": row,
444-
"column": content["column"],
446+
"column": column,
445447
"column_index": content["column_index"],
446448
"value": value,
447449
}

js/datagrid.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ export class DataGridModel extends DOMWidgetModel {
219219
event_type: 'cell-changed',
220220
region: msg.region,
221221
row: msg.row,
222-
column: msg.column,
223222
column_index: msg.columnIndex,
224223
value: msg.value,
225224
},

0 commit comments

Comments
 (0)