✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Sharing data in a multipage app

Hi fellows,

I’m working with a dcc.Location component with two different URLs, “page.com/static” and “page.com/animate”;

I’m using the same pattern of the documentation, but it’s not sharing the I change from /static to /animate

The structure of layout:
image

The callback of Location/url component

What do I need to do to share the data between the multipage app?

I would be very grateful if someone can help me with this problem.

Best Regards,
Leonardo

You can have a dcc.Store component in your base layout that would save the changes and then have layout_static and layout_animation defined as functions that take the dcc.Store's data to apply the changes to each layout.

Without knowing more of what is going to be changed/what is similar between the two layouts it is difficult to give you more advice.

Hi buddy, thank you for you answer.

I will try to explain the application:

I will start through the /static url… So, I will set the desired data, and click on “submit”, so it will query on DB and return a dateset with 24 rows and 17 columns. As you can see on screenshot below:

So, if the user click on “Go to Animation” button, it will change to the /animation and loads the layout_animation, where I will use the same table to create an animated chart;

I tried to find more informations about doing it with a function, but I can’t… I would be absolutelly grateful if you can give me more informations about how can I do it.

Feel free to request more information if needed; Thank you very much Renaud

Hey broo,

I did it only by setting the dcc.Location to “refresh=False” and it’s now working well !!!

image

Anyway, thank you very much for your attention and feel free to give some alternatives that can be better for this problem!!!

Best,
Leonardo