rowData does not change upon managed row dragging
yreiss opened this issue · 2 comments
yreiss commented
When creating a table allowing row dragging, I expected the row data to change upon re-ordering (or have any other indication of the new row order).
Running the code below, I expected the row_changed() callback to be called upon any change in row order but it doesn't get called.
Also, using other callbacks that are being called I inspected the state of the rowData and it indeed it never changes (does not appear in the code).
Could you please provide a way for the application to retrieve the new order of rows?
from dash import Dash, html, Output, Input
import dash_ag_grid as dag
app = Dash(__name__)
columnDefs = [
{ 'field': 'Id' },
{ 'field': 'Value' },
]
data = [{"Id": 1, "Value": 1}, {"Id": 2, "Value": 2}]
grid = dag.AgGrid(
id="draggable",
rowData=data,
columnDefs=columnDefs,
defaultColDef={"rowDrag": True},
dashGridOptions={"rowDragManaged": True}
)
app.layout = html.Div([grid])
app.run()
@app.callback(
Output("draggable", "rowData"),
Input("draggable", "rowData")
)
def rows_changed(data: list) -> list:
print("got here")
return data