Skip to content
This repository has been archived by the owner on Jun 22, 2019. It is now read-only.

sort/selected rows reset while using PreventUpdate exception on callback #73

Open
rquintino opened this issue Jun 11, 2018 · 0 comments

Comments

@rquintino
Copy link

When using table and PreventUpdate exception on a callback, although the table data is not changed as expected by raising PreventUpdate , table sort/selected indexes seem to reset.

Checked the periodic http call for the interval component, seem to return expected 204/no content response, but still triggering table filter/sort/selections

related threads:
plotly/dash#190
#64

http response:
HTTP/1.0 204 NO CONTENT
Content-Type: text/html; charset=utf-8
Content-Length: 0
Server: Werkzeug/0.14.1 Python/3.6.3
Date: Mon, 11 Jun 2018 08:52:27 GMT

http request:
{"output":{"id":"datatable-simple","property":"rows"},"inputs":[{"id":"my-interval","property":"n_intervals","value":538}]}

app
import datetime
import sys
import pandas as pd

app = dash.Dash()

DF_SIMPLE = pd.DataFrame({
'x': ['A', 'B', 'C', 'D', 'E', 'F'],
'y': [4, 3, 1, 2, 3, 6],
'z': ['a', 'b', 'c', 'a', 'b', 'c']
})

app.layout = html.Div([
html.H4('DataTable Sample',id="app_title"),
dt.DataTable(
rows=DF_SIMPLE.to_dict('records'),id='datatable-simple'
),
dcc.Interval(id='my-interval', interval=5000),
], className="container")

app.css.append_css({
'external_url': 'https://codepen.io/chriddyp/pen/bWLwgP.css'
})

@app.callback(
Output('datatable-simple', 'rows'),
[Input('my-interval', 'n_intervals')])
def update_table(n):
print("Checking...")
raise dash.exceptions.PreventUpdate("No data changed!")

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant