@@ -189,6 +189,18 @@ def _data_to_json(x, obj):
189189}
190190
191191
192+ def _widgets_dict_to_json (x , obj ):
193+ return {
194+ str (k ): widget_serialization ["to_json" ](v , obj ) for k , v in x .items ()
195+ }
196+
197+
198+ _widgets_dict_serialization = {
199+ "from_json" : widget_serialization ["from_json" ],
200+ "to_json" : _widgets_dict_to_json ,
201+ }
202+
203+
192204class DataGrid (DOMWidget ):
193205
194206 """A Grid Widget with filter, sort and selection capabilities.
@@ -322,7 +334,7 @@ class DataGrid(DOMWidget):
322334 _data = Dict ().tag (sync = True , ** _data_serialization )
323335
324336 renderers = Dict (Instance (CellRenderer )).tag (
325- sync = True , ** widget_serialization
337+ sync = True , ** _widgets_dict_serialization
326338 )
327339 default_renderer = Instance (CellRenderer ).tag (
328340 sync = True , ** widget_serialization
@@ -336,14 +348,17 @@ class DataGrid(DOMWidget):
336348 selection_mode = Enum (
337349 default_value = "none" , values = ["row" , "column" , "cell" , "none" ]
338350 ).tag (sync = True )
339- selections = List (Dict ()).tag (sync = True , ** widget_serialization )
351+ selections = List (Dict ()).tag (sync = True )
340352 editable = Bool (False ).tag (sync = True )
341353 column_widths = Dict ({}).tag (sync = True , ** _data_serialization )
342- grid_style = Dict (allow_none = True ).tag (sync = True , ** widget_serialization )
354+ column_widths = Dict ({}).tag (sync = True )
355+ grid_style = Dict (allow_none = True ).tag (
356+ sync = True , ** _widgets_dict_serialization
357+ )
343358 auto_fit_columns = Bool (False ).tag (sync = True )
344359 auto_fit_params = Dict (
345360 {"area" : "all" , "padding" : 30 , "numCols" : None }, allow_none = False
346- ).tag (sync = True , ** widget_serialization )
361+ ).tag (sync = True )
347362
348363 def __init__ (self , dataframe , ** kwargs ):
349364 # Setting default index name if not explicitly
0 commit comments