rowData return None

Python Dash Agrid Table

The problem is that the table variable is available and correctly displayed in the console within the first if cell_changed: block, but it becomes None in the second, nested if zmiana["colId"]=="price" and if zmiana["data"]["name"]=="new" blocks.

@app.callback(
    Output('grid-id', 'rowData'),
    Input('grid-id', 'cellValueChanged'),
    State('grid-id', 'rowData'),
    prevent_initial_call=True
)
def update_grid_data(cell_changed, table):
    if cell_changed:
        print(table) # Here table working , i see dict list table in console
        zmiana=cell_changed[0]
        
        
        if zmiana["colId"]=="price":
            if zmiana["data"]["name"]=="new":
                print("ok") # This print working ,the if condition is true !
                print(table) # here print return None , why ????!!! :)
                return table
                
    else:
        return no_update

Hello @Mar7872x,

Welcome to the community!

You need to remove the else on your statement. You are returning absolutely nothing if there was a change and it wasn’t the column.

Thx for answer and your time. So it was a syntax and logic error related to the if statement and the no_update return.

1 Like