Pivottable doesn't get updated in successive callbacks
See original GitHub issueThis works:
import dash
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_pivottable
app = dash.Dash(__name__)
app.layout = html.Div(
[html.Button("Rfresh", id="button"), html.Div(id="pivottable_div")]
)
@app.callback(Output("pivottable_div", "children"), [Input("button", "n_clicks")])
def refresh_pivottable(n_clicks):
if n_clicks:
print(n_clicks)
return [
html.Div(str(n_clicks)),
dash_pivottable.PivotTable(data=[["a"], [n_clicks]], cols=["a"])
if n_clicks % 2 == 1
else "a",
]
if __name__ == "__main__":
app.run_server(debug=False)
This doesn’t:
import dash
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_pivottable
app = dash.Dash(__name__)
app.layout = html.Div(
[html.Button("Rfresh", id="button"), html.Div(id="pivottable_div")]
)
@app.callback(Output("pivottable_div", "children"), [Input("button", "n_clicks")])
def refresh_pivottable(n_clicks):
if n_clicks:
print(n_clicks)
return [
html.Div(str(n_clicks)),
dash_pivottable.PivotTable(data=[["a"], [n_clicks]], cols=["a"])
# if n_clicks % 2 == 1
# else "a",
]
if __name__ == "__main__":
app.run_server(debug=False)
The only difference of them is the 2 commented lines.
My environment:
windows7 64bit
python3.7 64bit
dash 1.4.1
Please run the cases to see the difference. Many thanks.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9
Top Results From Across the Web
Pivottable doesn't get updated in successive callbacks #10
This works: import dash import dash_html_components as html from dash.dependencies import Input, Output import dash_pivottable app = dash.
Read more >Refresh PivotTable data - Microsoft Support
Manually refresh or update data in a PivotTable that's connected to an external data source to see changes that were made to that...
Read more >Excel Pivot Table Refresh Steps and Fixes - Contextures
Refresh Multiple Pivot Caches. If there are two or more pivot tables in your workbook, based on different data sources, they won't all...
Read more >Countif dax - Divadonna.it
When it gets to the end of the table, DAX will go to the outer formula, SUMX, ... the number for less than...
Read more >excel hierarchy tree from data - Ramozzi & Friends
getDataPath(data) callback to tell the grid the hierarchy for each row. 23 de set. To create hierarchies, you'll need to enable the Power...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Update: My problem is caused by the table’s ID, I generate every table with a random table id in callbacks solved my problem.
@adrienpacifico I had the same problem with loading in contents from a file that is chosen by a dropdown. This solution works for me. I think @wittyfans did it with some random number generator but the main point seems to be to change the id.