@@ -1494,7 +1494,7 @@ def put_datatable(
14941494 instance_id = '' ,
14951495 column_order : Union [SequenceType [str ], MappingType ] = None ,
14961496 column_args : MappingType [Union [str , Tuple ], MappingType ] = None ,
1497- grid_args : MappingType [str , MappingType ] = None ,
1497+ grid_args : MappingType [str , Any ] = None ,
14981498 enterprise_key = '' ,
14991499 scope : str = None ,
15001500 position : int = OutputPosition .BOTTOM
@@ -1540,6 +1540,7 @@ def put_datatable(
15401540 :param list column_order: column order, the order of the column names in the list will be used as the column order.
15411541 If not provided, the column order will be the same as the order of the keys in the first row of ``records``.
15421542 When provided, the column not in the list will not be shown.
1543+ Note that ``column_order`` must be specified when ``records`` is empty.
15431544
15441545 .. collapse:: Notes when the row record is nested dict
15451546
@@ -1631,6 +1632,9 @@ def put_datatable(
16311632 column_args = column_args or {}
16321633 grid_args = grid_args or {}
16331634
1635+ if not records and not column_order :
1636+ raise ValueError ('`column_order` must be specified when `records` is empty' )
1637+
16341638 if isinstance (height , int ):
16351639 height = f"{ height } px"
16361640 if height == 'auto' and len (records ) > 1000 :
0 commit comments