Nothing Special   »   [go: up one dir, main page]

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] scrollTo Jumps the Scroll Bar #3085

Closed
georgiossalon opened this issue Nov 19, 2024 · 2 comments
Closed

[BUG] scrollTo Jumps the Scroll Bar #3085

georgiossalon opened this issue Nov 19, 2024 · 2 comments

Comments

@georgiossalon
Copy link
georgiossalon commented Nov 19, 2024
  • pip list
dash                 2.18.2
dash_ag_grid         31.2.0
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-table           5.0.0
  • Browser, Version and OS

    • OS: win11
    • Browser chrome
    • Version 130.0.6723.119 (Offizieller Build) (64-Bit)

Describe the bug

Adjusting the scrollTo and selecting a row makes the scroll bar to jump back to the position set in my callback. The callback is getting triggered only once though in the beginning.

Expected behavior

Since the callback is not getting triggered when selecting a row, the scroll bar should stay where I manually scrolled.

Code

import dash_ag_grid as dag
from dash import Dash, html, Input, Output
import pandas as pd


app = Dash(__name__)

df = pd.read_csv(
    "https://raw.githubusercontent.com/plotly/datasets/master/ag-grid/olympic-winners.csv"
)


columnDefs = [
    {"headerName": "Row", "valueGetter": {"function": "params.node.rowIndex"}}
] + [{"field": c} for c in df.columns]

app.layout = html.Div(
    [
        dag.AgGrid(
            id="grid-scroll-to-start",
            columnDefs=columnDefs,
            rowData=df.to_dict("records"),
            dashGridOptions={'rowSelection': 'single', 'animateRows': False}
        ),
    ]
)

@app.callback(
    Output('grid-scroll-to-start', 'scrollTo'),
    Input('grid-scroll-to-start', 'rowData')
)
def handle_scroll_to(rowData):
    #dummy logic
    row = rowData[100]
    return {'data': row}


if __name__ == "__main__":
    app.run(debug=True)
@AnnMarieW
Copy link
Collaborator

Hi @georgiossalon

I can't seem to replicate the issue - Your app seems to work fine on PyCafe

@georgiossalon
Copy link
Author

@AnnMarieW You are right! This is a strange behaviour. I tested this locally within another folder and got the same problem. I then went and built it in a VM and there I didnt get it. We can close it for now, as the error doesnt seem to be always re producable.

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

No branches or pull requests

2 participants