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

[Bug] Components not working in the Detail Grid #237

Closed
rpforrest1 opened this issue Aug 31, 2023 · 1 comment · Fixed by #238
Closed

[Bug] Components not working in the Detail Grid #237

rpforrest1 opened this issue Aug 31, 2023 · 1 comment · Fixed by #238

Comments

@rpforrest1
Copy link

I am wanting to use cell renderers for the Detail Grid. In the example below, I am unable to get markdown to render inside a Detail Grid. I hope to expand this out to use any cellRenderer (not just markdown).

Below is an example to reproduce the issue.

from dash import Dash, html
import dash_ag_grid as dag

import os

app = Dash(__name__)

masterColumnDefs = [
    {
        "headerName": "Country",
        "field": "country",
        "cellRenderer": "agGroupCellRenderer",
        "cellRendererParams": {
            'innerRenderer': "markdown",
        },
    },
    {
        "headerName": "Region", 
        "field": "region"
    },
    {
        "headerName": "Population",
        "field": "population"
    },
    {
        "headerName": "Test Link",
        "field": "test_link",
        "cellRenderer": "markdown",
    },
]
detailColumnDefs = [
    {
        "headerName": "City", 
        "field": "city",
        "resizable": True,
        "cellRenderer": "markdown"
    },
    {
        "headerName": "Pop. (City proper)", 
        "field": "population_city",
        "resizable": True,
    },
    {
        "headerName": "Pop. (Metro area)",
        "field": "population_metro",
        "resizable": True,
    },
    {
        "headerName": "Test Render",
        "field": "test_render",
        "resizable": True,
        "cellRenderer": "agGroupCellRenderer",
        "cellRendererParams": {
            'checkbox': True,
            'innerRenderer': "markdown",
        },
    }
]
rowData = [
    {
        "country": "**China**",
        "region": "Asia",
        "population": 1411778724,
        "test_link":"[Blank Test Link](/)",
        "cities": [
            {
                "city": "**Shanghai**",
                "population_city": 24870895,
                "population_metro": "NA",
                "test_render": "**BOLD TEST**"
            },
            {
                "city": "**Beijing**",
                "population_city": 21893095,
                "population_metro": "NA",
                "test_render": "**BOLD TEST**"
            },
            {
                "city": "**Chongqing**",
                "population_city": 32054159,
                "population_metro": "NA",
                "test_render": "**BOLD TEST**"
            },
        ],
    },
    {
        "country": "**India**",
        "region": "Asia",
        "population": 1383524897,
        "test_link":"[Blank Test Link](/)",
        "cities": [
            {
                "city": "**Delhi**",
                "population_city": 16753235,
                "population_metro": 29000000,
                "test_render": "**BOLD TEST**"
            },
            {
                "city": "**Mumbai**",
                "population_city": 12478447,
                "population_metro": 24400000,
                "test_render": "**BOLD TEST**"
            },
            {
                "city": "**Kolkata**",
                "population_city": 4496694,
                "population_metro": 14035959,
                "test_render": "**BOLD TEST**"
            },
        ],
    },
    {
        "country": "**United States**",
        "region": "Americas",
        "population": 332593407,
        "test_link":"[Blank Test Link](/)",
        "cities": [
            {
                "city": "**New York**",
                "population_city": 8398748,
                "population_metro": 19303808,
                "test_render": "**BOLD TEST**"
            },
            {
                "city": "**Los Angeles**",
                "population_city": 3990456,
                "population_metro": 13291486,
                "test_render": "**BOLD TEST**"
            },
            {
                "city": "**Chicago**",
                "population_city": 2746388,
                "population_metro": 9618502,
                "test_render": "**BOLD TEST**"
            },
        ],
    },
    {
        "country": "**Indonesia**",
        "region": "Asia",
        "population": 271350000,
        "test_link":"[Blank Test Link](/)",
        "cities": [
            {
                "city": "**Jakarta**",
                "population_city": 10154134,
                "population_metro": 33430285,
                "test_render": "**BOLD TEST**"
            },
        ],
    },
]


app.layout = html.Div(
    [
        dag.AgGrid(
            id="simplified-master-detail-example",
            enableEnterpriseModules=True,
            licenseKey=os.environ["AGGRID_ENTERPRISE"],
            columnDefs=masterColumnDefs,
            rowData=rowData,
            columnSize="sizeToFit",
            masterDetail=True,
            detailCellRendererParams={
                "detailGridOptions": {
                    "columnDefs": detailColumnDefs,
                },
                "detailColName": "cities",
                "suppressCallback": True,
            },
            dashGridOptions={"detailRowAutoHeight": True},
        ),
    ]
)


if __name__ == "__main__":
    app.run(host="127.0.0.1", debug=True)
dash_test
BSd3v added a commit to BSd3v/dash-ag-grid-real that referenced this issue Aug 31, 2023
@BSd3v BSd3v linked a pull request Aug 31, 2023 that will close this issue
@BSd3v
Copy link
Collaborator

BSd3v commented Aug 31, 2023

Hello @rpforrest1,

Thank you for finding this issue, I have created a PR with the fix. 😄

BSd3v added a commit that referenced this issue Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants