Skip to content

Commit

Permalink
Fix for frontend turning column names as integers into strings
Browse files Browse the repository at this point in the history
Signed-off-by: martinRenou <martin.renou@gmail.com>
  • Loading branch information
martinRenou committed May 14, 2024
1 parent f1f8b15 commit ac4c74d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 4 additions & 2 deletions ipydatagrid/datagrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,15 +433,17 @@ def __init__(self, dataframe, index_name=None, **kwargs):
def __handle_custom_msg(self, _, content, buffers): # noqa: U101,U100
if content["event_type"] == "cell-changed":
row = content["row"]
column = content["column"]
column = self._column_index_to_name(
self._data, content["column_index"]
)
value = content["value"]
# update data on kernel
self._data["data"].loc[row, column] = value
# notify python listeners
self._cell_change_handlers(
{
"row": row,
"column": content["column"],
"column": column,
"column_index": content["column_index"],
"value": value,
}
Expand Down
1 change: 0 additions & 1 deletion js/datagrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ export class DataGridModel extends DOMWidgetModel {
event_type: 'cell-changed',
region: msg.region,
row: msg.row,
column: msg.column,
column_index: msg.columnIndex,
value: msg.value,
},
Expand Down

0 comments on commit ac4c74d

Please sign in to comment.