plotly / plotly/dash

DataTable fixed_rows column size resizing back and forth on data load

Open
#1,890 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug dash-data-table P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

Thank you so much for helping improve the quality of Dash!

We do our best to catch bugs during the release process, but we rely on your help to find the ones that slip through.

Describe your context
I am currently using Dash datatable for my use case and I am using fixed_rows to fix the header.
After setting it, when I refresh the page, the column size resizing to 0 and once the df data (table data) loaded it comes back to original table state. This is bit annoying and user experience is impacted.
Also if I apply some filter (native) and if no data matched the column width size is reducing to 0.

  • replace the result of pip list | grep dash below
dash                      2.0.0
dash-bootstrap-components 1.0.2
dash-core-components      2.0.0
dash-html-components      2.0.0
dash-table                5.0.0
  • if frontend related, tell us your Browser, Version and OS

    If no data to show in table or during refresh of webpage or filter the column, then the width is automatically changing to 0 size

Describe the bug

I am currently using Dash datatable for my use case and I am using fixed_rows to fix the header.
dash-table 5.0.0
After setting it, when I refresh the page, the column size resizing to 0 and once the df data (table data) loaded it comes back to original table state. This is bit annoying and user experience is impacted.
Also if I apply some filter (native) and if no data matched the column width size is reducing to 0.

A clear and concise description of what you expected to happen.

image

image

image

If applicable, add screenshots or screen recording to help explain your problem.

Below is my code used:
dbc.Row([
dbc.Col(
dt.DataTable(
id='weekly_table_output',
columns=[{"name": colname, "id": colname} for colname in DEFAULT_COLUMNS],
# columns = form_list_cols(df.columns),
filter_action="native",
sort_action="native",
sort_mode="multi",
page_action="native",
page_current= 0,
page_size= 75,
tooltip_header={header: header for header in DEFAULT_COLUMNS},
tooltip_duration=None,
fixed_rows={ 'headers': True, 'data': 0},
fixed_columns={'headers': True, 'data': 2},
style_table={
'minHeight': '70vh', 'height': '70vh', 'maxHeight': '70vh',
'minWidth': '100%',
},
style_cell={
'minWidth': '130px', 'width': '130px', 'maxWidth': '130px',
'textAlign': 'left',
'fontSize':12,
'font-family': 'sans-serif',
'padding': '5px',
'overflow': 'hidden',
'textOverflow': 'ellipsis',
},
style_data={
'maxWidth': 0,
'color': 'black',
'backgroundColor': 'white',
'border': '1px solid black'
},
style_header={
'backgroundColor': '#90EE90',
'color': 'black',
# 'fontWeight': 'bold',
'fontSize':14,
'border': '1px solid black',
},
css=[{
'selector': '.dash-table-tooltip',
'rule': 'background-color: black; font-family: sans-serif; color: white; fontSize: 13'
}]
),
width={"size": 11, "offset": 0}),
]),

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied Dash DataTable configuration with fixed_rows, fixed_columns, native filtering, and the reported Dash 2.0.0 and dash-table 5.0.0 versions. Check column sizing during page refresh, data loading, and filters with no matches; done means widths no longer collapse to zero in those states.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.