New in Dash AG Grid V2.0.0a4
There is not a lot new in alpha release #4 - just a few bug fixes and a big prop cleanup. This might be our last pre-release prior to the full 2.0.0 release
If you haven’t tried dash-ag-grid, now’s the time!
It will only take a sec.
Do it!
Do it!
Do it now!
I know you want to
pip install dash-ag-grid==2.0.0a4
Here’s a simple app to try out some basic AG Grid features:
- Sort by clicking on the heading
- Re-order the columns by dragging them to a different position
- Resized the columns by dragging the top right portion of the column
- Pin columns by dragging them to the edge until the pin icon appears
- Click on a cell to demo triggering a Dash callback
from dash import Dash, html, Input, Output
import dash_ag_grid as dag
import pandas as pd
df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/solar.csv")
app = Dash(__name__)
grid = dag.AgGrid(
id="quickstart-grid",
rowData=df.to_dict("records"),
columnDefs=[{"field": i, "id": i} for i in df.columns],
defaultColDef={"resizable": True, "sortable": True, "filter": True},
columnSize="sizeToFit",
getRowId="params.data.State"
)
app.layout = html.Div([grid, html.Div(id="quickstart-output")])
@app.callback(
Output("quickstart-output", "children"), Input("quickstart-grid", "cellClicked")
)
def display_cell_clicked_on(cell):
if cell is None:
return "Click on a cell"
return f"clicked on cell value: {cell['value']}, column: {cell['colId']}, row index: {cell['rowIndex']}"
if __name__ == "__main__":
app.run_server(debug=True)
Calling all superusers!
Thanks to everyone who tried the alpha versions of dash-ag-grid, with your help we have found and fixed (or more accurately, @jinnyzor fixed) all the reported issues. Now is the time to really put dash-ag-grid through the wringer - we would like to shake out any bugs prior to the full release.
Migrating to a4
For those of you who are on a3, when you upgrade to a4, it will likely break your app. But no worries, it’s easy to fix. We deleted a lot of props, but they are still available, they just need to be included in dashGridOptions
or in the case of cellStyle
moved to the column definitions.
For example, most errors can be fixed like this:
# old way
dag.AgGrid(
rowSelection="multiple",
# other props
)
# new way
dag.AgGrid(
dashGridOptions={"rowSelection": "multiple"},
# other props
)
Update for the cellStyle
prop only:
# old way
dag.AgGrid(
cellStyle=cellStyle,
# other props
)
# new way
dag.AgGrid(
defaultColDef={"cellStyle": cellStyle},
# other props
)