vizro icon indicating copy to clipboard operation
vizro copied to clipboard

AgGrid doesn't work with `persistence` props

Open huong-li-nguyen opened this issue 11 months ago • 2 comments

Description

Not sure if this has been discussed before, but the persistence props do not work with the AgGrid in Vizro, while they work fine in a pure dash app.

Expected behavior

I would expect the persistence props to work as expected, but currently they do not seem to have an effect e.g. when configuring the persistence props, the inserted values still get lost after refreshing the page.

On another note, I think they should also be turned on as default for the dash_ag_grid function (similar how we turn it on automatically for the other components).

Which package?

vizro

Package version

0.1.14

Python version

3.9

OS

How to Reproduce

  1. Run the code below with the latest vizro version
  2. Insert a value inside the floatingFilter
  3. Refresh the page
"""Example to show dashboard configuration."""

import vizro.models as vm
import vizro.plotly.express as px
from vizro import Vizro
from vizro.tables import dash_ag_grid

df = px.data.gapminder()

page = vm.Page(
    title="Enhanced AG Grid",
    components=[
        vm.AgGrid(
            title="Dash AG Grid",
            figure=dash_ag_grid(
                data_frame=df,
                columnDefs=[
                    {"field": "country", "floatingFilter": True, "suppressMenu": True},
                    {"field": "continent", "floatingFilter": True, "suppressMenu": True},
                    {"field": "year"},
                    {"field": "lifeExp", "cellDataType": "numeric"},
                    {"field": "pop", "cellDataType": "numeric"},
                    {"field": "gdpPercap", "cellDataType": "euro"},
                ],
                persistence=True,
                persisted_props=["filterModel"]
            ),
        ),
    ],
    controls=[vm.Filter(column="continent")],
)
dashboard = vm.Dashboard(pages=[page])

if __name__ == "__main__":
    Vizro().build(dashboard).run()

Output

No response

Code of Conduct

huong-li-nguyen avatar Mar 26 '24 13:03 huong-li-nguyen

This is part of the backlog, but not prioritised for this sprint: https://github.com/McK-Internal/vizro-internal/issues/660. Would propose closing either due to duplication, which one is preferable?

maxschulz-COL avatar Mar 26 '24 14:03 maxschulz-COL

I would leave this issue open so it's visible to OS users, as I am sure some will face the same issues especially if they use options such as the floatingFilter etc.

huong-li-nguyen avatar Mar 26 '24 14:03 huong-li-nguyen

Can we close this now? @petar-qb

antonymilne avatar Sep 18 '24 16:09 antonymilne

Yes, we can close it since this bug is fixed with https://github.com/mckinsey/vizro/pull/644.

petar-qb avatar Sep 19 '24 08:09 petar-qb