Skip to content

Commit e98d197

Browse files
committed
Add test
Signed-off-by: Itay Dafna <[email protected]>
1 parent 2d4983c commit e98d197

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/test_datagrid.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,20 @@ def test_default_dataframe_index(dataframe):
220220

221221
# Default and unused keys should not be in schema
222222
assert "key" in data_obj["schema"]["primaryKey"]
223+
224+
def test_setting_column_widths_on_multiindex_grid():
225+
import pandas as pd
226+
from ipydatagrid import DataGrid
227+
228+
col_names = [('Parent Column', 'SubCol 1'), ('Parent Column', 'SubCol 2')]
229+
df = pd.DataFrame(data={i: [1, 2, 3] for i in col_names},
230+
columns=col_names)
231+
232+
grid = DataGrid(df, layout={'height': '200px'})
233+
grid
234+
235+
col_widths = {
236+
('Parent Column', 'SubCol 1'): 100
237+
}
238+
239+
grid.column_widths = col_widths

0 commit comments

Comments
 (0)