Код: Выделить всё
import dash
from dash import html
from dash import dcc
from dash.dependencies import Input, Output, State
import dash_ag_grid
app = dash.Dash(__name__)
app.layout = html.Div([
dash_ag_grid.AgGrid(
id='ag-grid',
columnDefs=[
{'headerName': 'Make', 'field': 'make'},
{'headerName': 'Model', 'field': 'model'},
{'headerName': 'Price', 'field': 'price'}
],
rowData=[
{'make': 'Toyota', 'model': 'Corolla', 'price': 20000},
{'make': 'Ford', 'model': 'Focus', 'price': 25000},
{'make': 'BMW', 'model': 'X5', 'price': 60000}
],
enableEnterpriseModules=True,
dashGridOptions={
"enableRangeSelection":True,
"enableRangeSelectionParams":{
'onRangeSelectionChanged': 'onRangeSelectionChanged'
}
}
),
html.Div(id='output')
])
@app.callback(
Output('output', 'children'),
[Input('ag-grid', 'rangeSelectionChanged')],
)
def update_output(rangeSelection):
print(rangeSelection)
return rangeSelection
if __name__ == '__main__':
app.run_server(debug=True)
Подробнее здесь: https://stackoverflow.com/questions/784 ... ash-plotly