widgetti / widgetti/ipyvuetify
Vuetify Tabs shrinks Datagrid when you change layout
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 355
- Forks
- 61
- PR merge metrics
- No merged PRs in 30d
Description
I'll first show the problem and then I'll describe the problem and give a reproducible example.

I have an app that updates many DataGrid centrally and then displays them in different tabs.
I change the layout of the Datagrid depending on the number of rows.
- If I change the layout of a
DataGridfrom anipyvuetifyTab that is not active theDatagridgets shrunk. - oddly enough this only happens if I change the layout more the one time (so the first time you change it works fine)
- If you run the code below you'll see a button that changes the layout of a
DataGridand of av.Btn. - If you stay on the first tab and press the button twice, then go on the second tab, you will see the same result as the image above (
DataGridshrinks). - If you only press the button once the
DataGriddoesn't shrink.
I am not sure if the problem is with ipydatagrid or ipyvuetify so I'll cross-post in both repos, but I can say that (as you can see from the image above):
- if I use
ipywidgedstab instead ofipyvuetifytab the problems is not present (this suggest it might be a problem withipyvuetify) - if I change the layout of another widget instead of 'DataGrid' the problem is not present (this suggest it might be a problem with
ipydatagrid)
So maybe if could be a problem with both
This is really a mystery and it took me a long time to isolate the problem and boil it down to the change in the layout as it is part of a much more complex application.
I hope you can review it and come up with a solution.
Thanks a lot
import numpy as np
import pandas as pd
import ipywidgets as w
import ipyvuetify as v
from ipydatagrid import DataGrid
def make_df(rows=20, cols=2):
df = pd.DataFrame(np.random.uniform(size=(rows, cols))).round(2)
return df
n_grids = 1
n_tabs = 2
grids = [[DataGrid(make_df()) for i in range(n_grids)] for j in range(n_tabs)]
widgets = [
[
v.Btn(children=['Test with a different widget'], class_="ml-2")
for i in range(n_grids)
] for j in range(n_tabs)
]
children = [
w.VBox(
[
w.HBox(grids[i]),
w.HBox(widgets[i]),
]
) for i in range(n_tabs)
]
tab = w.Tab()
tab.children = children
for i in range(n_tabs):
tab.set_title(i, f'tab{i}')
tabs_bar = v.Tabs(
# dark=True,
v_model=None,
children=[v.Tab(children=[f'tab{i}']) for i in range(n_tabs)],
)
tabs_items = v.TabsItems(
v_model=None,
# dark=True,
children=[
v.TabItem(
children=[
w.VBox(
[
w.HBox(grids[i]),
w.HBox(widgets[i]),
]
)
]
) for i in range(n_tabs)
],
)
v_tab = v.Container(
class_="my-0 py-0",
fluid=True,
children=[
v.Row(children=[v.Col(children=[tabs_bar])]),
v.Row(children=[v.Col(children=[tabs_items])]),
]
)
w.jslink((tabs_bar, 'v_model'), (tabs_items, 'v_model'))
btn = v.Btn(children=['click to change layout'], outlined=True, color='primary')
def on_click_change_layout(widget, event, payload):
grids[1][0].layout = {
'width': '300px',
'height': '300px',
# 'align-content': 'center'
}
widgets[1][0].layout = {
'width': '500px',
# 'height': '300px',
# 'align-content': 'center'
}
btn.on_event('click', on_click_change_layout)
w.VBox(
[
btn,
v.Row(
children=[
v.Col(children=[v.Html(children=['ipywidgets'], tag='h1'), tab]),
v.Col(children=[v.Html(children=['ipyvuetify'], tag='h1'), v_tab])
]
)
]
)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied Python reproducer, focusing on the ipyvuetify Tabs and TabsItems interaction with the ipydatagrid DataGrid. Reproduce two layout changes while the second tab is inactive, then compare the DataGrid with the other widget and with the ipywidgets Tab example. Done means the DataGrid keeps its intended size after switching tabs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100