-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #201 from Farkites/cell-double-click
Add onCellDoubleClicked event
- Loading branch information
Showing
6 changed files
with
96 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
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="grid", | ||
rowData=df.to_dict("records"), | ||
columnDefs=[{"field": i} for i in df.columns], | ||
defaultColDef={ | ||
"resizable": True, | ||
"sortable": True, | ||
"filter": True, | ||
"minWidth": 125, | ||
}, | ||
columnSize="sizeToFit", | ||
) | ||
|
||
app.layout = html.Div([grid, html.Div(id="output")]) | ||
|
||
|
||
@app.callback(Output("output", "children"), Input("grid", "cellDoubleClicked")) | ||
def display_cell_double_clicked_on(cell): | ||
if cell is None: | ||
return "Double click on a cell" | ||
return f"Double clicked on cell value: {cell['value']}, column: {cell['colId']}, row index: {cell['rowIndex']}" | ||
|
||
|
||
if __name__ == "__main__": | ||
app.run_server(debug=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters