Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

whitespace on DataTable when merge_duplicate_headers= True #2870

Open
e-wallace opened this issue May 29, 2024 · 0 comments · May be fixed by #2939
Open

whitespace on DataTable when merge_duplicate_headers= True #2870

e-wallace opened this issue May 29, 2024 · 0 comments · May be fixed by #2939
Labels
bug something broken dash-data-table related to DataTable component P3 not needed for current cycle sev-4 cosmetic

Comments

@e-wallace
Copy link

e-wallace commented May 29, 2024

Describe your context
To reproduce run the following. Toggle merge_duplicate_headers= True

import dash
import pandas as pd
import dash_design_kit as ddk
from dash import dash_table

data = {
    "indication": ["Indication 1", "Indication 2"],
    "y1-450-mg-iv": [100, 200],
    "y1-900-mg-iv": [150, 250],
    "y1-300-mg-sc": [120, 220],
    "y1-600-mg-sc": [130, 230],
    "y1-1800-mg-obi": [140, 240],
    "y1-1200-mg-obi": [160, 260],
    "y1-900-mg-obi": [170, 270],
    "y1-600-mg-obi": [180, 280],
    "y2-450-mg-iv": [105, 205],
    "y2-900-mg-iv": [155, 255],
    "y2-300-mg-sc": [125, 225],
    "y2-600-mg-sc": [135, 235],
    "y2-1800-mg-obi": [145, 245],
    "y2-1200-mg-obi": [165, 265],
    "y2-600-mg-obi": [185, 285]
}

fr_posology_table_data = pd.DataFrame(data)

app = dash.Dash(__name__)

app.layout = dash_table.DataTable(
                    id='posology-data',
                    data=fr_posology_table_data.to_dict('records'),
                    columns=[
                        {'id': 'indication', 'name': ['', 'Indication'], 'type': 'text', 'editable': False},
                        {'id': 'y1-450-mg-iv', 'name': ['Year 1', '450 mg IV'], 'type': 'numeric'},
                        {'id': 'y1-900-mg-iv', 'name': ['Year 1', '900 mg IV'], 'type': 'numeric'},
                        {'id': 'y1-300-mg-sc', 'name': ['Year 1', '300 mg SC'], 'type': 'numeric'},
                        {'id': 'y1-600-mg-sc', 'name': ['Year 1', '600 mg SC'], 'type': 'numeric'},
                        {'id': 'y1-1800-mg-obi', 'name': ['Year 1', '1800 mg OBI'], 'type': 'numeric'},
                        {'id': 'y1-1200-mg-obi', 'name': ['Year 1', '1200 mg OBI'], 'type': 'numeric'},
                        {'id': 'y1-900-mg-obi', 'name': ['Year 1', '900 mg OBI'], 'type': 'numeric'},
                        {'id': 'y1-600-mg-obi', 'name': ['Year 1', '600 mg OBI'], 'type': 'numeric'},
                        {'id': 'y2-450-mg-iv', 'name': ['Year 2', '450 mg IV'], 'type': 'numeric'},
                        {'id': 'y2-900-mg-iv', 'name': ['Year 2', '900 mg IV'], 'type': 'numeric'},
                        {'id': 'y2-300-mg-sc', 'name': ['Year 2', '300 mg SC'], 'type': 'numeric'},
                        {'id': 'y2-600-mg-sc', 'name': ['Year 2', '600 mg SC'], 'type': 'numeric'},
                        {'id': 'y2-1800-mg-obi', 'name': ['Year 2', '1800 mg OBI'], 'type': 'numeric'},
                        {'id': 'y2-1200-mg-obi', 'name': ['Year 2', '1200 mg OBI'], 'type': 'numeric'},
                        {'id': 'y2-600-mg-obi', 'name': ['Year 2', '600 mg OBI'], 'type': 'numeric'}
                    ],
                    fixed_columns={'headers': True, 'data': 1},
                    style_table={'minWidth': '100%', 'maxWidth': '100%'},
                    editable = True,
                    merge_duplicate_headers= True
                )

if __name__ == '__main__':
    app.run_server(debug=True)

requirements.txt

dash-design-kit==1.9.0
dash==2.14.1
gunicorn==20.0.4
pandas>=1.1.5

Describe the bug

When merge_duplicate_headers= True there is a large amount of whitespace to the right of the table. It is visible when going to the boundary of the scroll bar. This issue is present with both dash_table.DataTable and ddk.DataTable

Expected behavior
The boundary is expected to be at the end of the last column of the dataTable.

Screenshots
Here you can see the whitespace
Screen Shot 2024-05-29 at 1 01 00 PM

@Coding-with-Adam Coding-with-Adam added bug something broken sev-4 cosmetic labels Jun 7, 2024
@gvwilson gvwilson assigned gvwilson and unassigned gvwilson Jul 26, 2024
@gvwilson gvwilson added the P3 not needed for current cycle label Aug 13, 2024
@gvwilson gvwilson changed the title [BUG] whitespace on DataTable when merge_duplicate_headers= True whitespace on DataTable when merge_duplicate_headers= True Aug 13, 2024
@gvwilson gvwilson added the dash-data-table related to DataTable component label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken dash-data-table related to DataTable component P3 not needed for current cycle sev-4 cosmetic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants