Skip to content

Grid does not render when getRowId is explicitly set to None #417

Closed

Description

@tlauli

Affects dash-ag-grid version: 32.3.2, it worked in 31.3.1.

Ag grid fails to render when the getRowId argument is explicitly set to None, its default value.

from dash import Dash
import dash_ag_grid as dag

layout = [
    dag.AgGrid(
        rowData=[{"test": 1}],
        columnDefs=[{"field": "test"}],
        getRowId=None,
    ),
]


app = Dash(__name__)
app.layout = layout
app.run(debug=True)

Error:

(This error originated from the built-in JavaScript code that runs Dash apps. Click to see the full stack trace or open your browser's console.)
TypeError: t is not a function

    at http://127.0.0.1:8050/_dash-component-suites/dash_ag_grid/async-community.js:1:15220

    at Io.setId (http://127.0.0.1:8050/_dash-component-suites/dash_ag_grid/async-community.js:50:29517)

    at Io.setDataAndId (http://127.0.0.1:8050/_dash-component-suites/dash_ag_grid/async-community.js:50:28743)

    at U1.createNode (http://127.0.0.1:8050/_dash-component-suites/dash_ag_grid/async-community.js:189:58137)

    at http://127.0.0.1:8050/_dash-component-suites/dash_ag_grid/async-community.js:189:54575

    at Array.map (<anonymous>)

    at U1.setRowData (http://127.0.0.1:8050/_dash-component-suites/dash_ag_grid/async-community.js:189:54559)

    at sv.setRowData (http://127.0.0.1:8050/_dash-component-suites/dash_ag_grid/async-community.js:189:72154)

    at sv.setInitialData (http://127.0.0.1:8050/_dash-component-suites/dash_ag_grid/async-community.js:189:61883)

    at sv.start (http://127.0.0.1:8050/_dash-component-suites/dash_ag_grid/async-community.js:189:61771)

Activity

  1. BSd3v commented on Dec 1, 2025

    @BSd3v
    Collaborator

    Hello @tlauli,

    This seems like an upstream issue with how AG Grid renders. While we can make a workaround in the code, there is no default value passed to the grid, and never was.

    Could you please elaborate why you are setting the getRowId to None?

  2. tlauli commented on Dec 1, 2025

    @tlauli
    Author

    The default value of None is in the generated python ag grid constructor. As a python developer, I find it very unintuitive that it behaves differently based on whether the default argument is specified explicitly or not (I'm guessing it leads to some null vs undefined difference in js).

    As for why we are setting it to None, we have a wrapper around the ag grid constructor which which takes care of setting a lot of the args that we want to be the same every time (some styling, event listeners, default col def etc.), and this wrapper has the get_row_id as an optional argument.

    We can workaround this like

    **({get_row_id: get_row_id} if get_row_id is not None else {}),

    but this does not play well with static typecheckers and is hard to read.

    This is perhaps a symptom of a larger (in scope) issue with dash, and that is the inability to express the undefined js value.

    EDIT: get_row_style fixed to get_row_id

  3. BSd3v commented on Dec 2, 2025

    @BSd3v
    Collaborator

    I see the issue is with what the typing is placing, what is passed to the grid when you set a grid can be seen by using the to_plotly_json(), this will show the real default values:

    from dash import Dash
    import dash_ag_grid as dag
    
    grid = dag.AgGrid(
            rowData=[{"test": 1}],
            columnDefs=[{"field": "test"}],
        )
    
    print(grid.to_plotly_json())
    
    layout = [
        grid,
    ]
    
    
    app = Dash(__name__)
    app.layout = layout
    app.run(debug=True)
    

    As far as undefined I find it counter intuitive to define something as undefined. But you are welcome to submit a PR on the dash repo to allow for the setting of an undefined value to a prop.


    Also, going back to your example, I am a little confused but the getRowId which is the subject of the issue, but the example you provided is using getRowStyle. But I'm assuming the concept is the same... yes, you shouldnt pass a key to the grid unless it can handle a null in the upstream AG Grid.

  4. tlauli commented on Dec 2, 2025

    @tlauli
    Author

    There should be get_row_id, I mistyped, edited the comment.

    undefined may not be the best name, I agree, possibly something as no_value would be better.

    When I have time I will make a new issue in the dash repo with the description of the problem and my proposed solution, and then try to implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions