-
Notifications
You must be signed in to change notification settings - Fork 144
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
Dynamic page/tab creation #902
Comments
Hey again @gtauzin :), having a dynamic number of pages is tricky, but I will refer to @antonymilne for the final verdict, as he has worked on that before, but maybe you could look into this page to come up with alternative easier solutions: https://vizro.readthedocs.io/en/stable/pages/user-guides/custom-figures/#dynamic-number-of-cards The example posted is about dynamic cards, but potentially you could have dynamic tabs, which might even be nicer when comparing a chart. Just an idea! |
Hi @maxschulz-COL and thank you for your reply. I have seen the dynamic card creation, but the idea is really to provide a new view to the user on which s/he can apply different filters and selectors. So dynamic pages creation would be really great. I would still be interested in dynamic tabs too as a backup plan or for new features! :) |
I can confirm that I could make this works for dynamic tab creation based on the card example. This is the corresponding PyCafe example. I also understand that the card example cannot be extended to pages are the custom figure is contained inside a page. Would love to know if there is any other way to dynamic pages! Thank you :) |
Hi @gtauzin and sorry for the slow response - I was pondering different options here. Adding pages on the fly is basically not possible because of underlying limitations of Dash pages. The Dash page registry, which Vizro is built on top of and handles all the routing and page building, is really designed to be fixed upfront and not modified during runtime. You could maybe hack something together that sort of works, but it would only be suitable for a single user, single worker app. The reason for this is that any hack would not be stateless as it would modify global However, one thing that is possible in Dash, and is sort of possible in Vizro is to provide a template for a page where the content can be dynamically served dependent on the path or a query parameter like in this bit of the Dash docs on variable paths and the one that follows on query parameters. Do you think that a pattern like that might serve your needs? If not then I'm afraid that dynamic tabs or containers is the closest you'll be able to get. |
Hi @antonymilne. No need to apologize, I am grateful you take some of your time to answer my questions! :) Thanks for the explanation. I am not sure I understand exactly what your suggestion implies concretely. The pages cannot be dynamically created but can be dynamically served: Would that mean I just need to write some kind of template for the creation of a new page and I can then "access" this page on my dashboard? How would accessing it typically work? Would I be able to control it through a parameter? I think I would be very interested in such a solution as all pages I wish to generate are the same but just looking at specific event files. Thank you again for your help! |
Question
Hi vizro team!
Is it possible to allow a user to dynamically create a new page or a new tab?
Code/Examples
Maybe to illustrate what I mean, let me give you a naive example. Let's imagine I have the GDP over years of a bunch of country. In my navigation panel, I select a single country. On the pages side panel there is an icon with a "+" and if I click on it, I can create a new page on which I can select a different country and just change page to alternate GDP plot per selected countries.
Thanks a lot for your feedback! :)
Which package?
vizro
Code of Conduct
The text was updated successfully, but these errors were encountered: