Hi,
I am making a new dash app and as my content is growing I want to deploy a multipage app. I went through the tutorial and it work fine. Now I want something like this.
Tab were useful but they are not continued in the further version. Even the latest rc version does not have it. I think the support is discontinued. Plus there is still no example where a full layout is fetched from another page in a tab.
Whether or not support of dcc.Tabs() are discontinued is something I will need @chriddyp to help with .
You write that you need an example “where a full layout is fetched from another page in a tab.” I am not sure what you mean, is it something like this?
You should be able to give the Div’s with “some really cool stuff” in them a URL using the dcc.Location component if you need it for anything. (This is not something I have tested )
Inspired by the vanguard report app with multiple tabs I am setting up a similar arrangement…!
I am finding that once I generate a number of plots in one tab, when I jump to the another tab, the graphics are not downloaded (started) properly, The user would have to refresh the page in that new tab to keep running the app…
What I found is to follow the MVC structure while using tabs can be useful and things does not clash.
The folder structure I use is like
|-apps
|–Component Dir
|—component_controller
|—component_view
|—component_html
the view is the page that defines your view and should contains all the callbacks. and the main layout = " html""
Controller will contain all the logic. Suppose an API call you want to make.
In view do something like this
from apps.Component_Dir.component_controller import Get_data_app1
get_data = Get_data_app1()
@app.callback(
Output("custom_fields_pie_chart", "figure"),
[Input("custom_field_dropdown", "value")]
)
def update_custom_field_pie_chart(custom_field_dropdown):
print(custom_field_dropdown)
if custom_field_dropdown is None:
raise dash.exceptions.PreventUpdate()
else:
return get_data.draw_custom_field_pie_chart(custom_field_dropdown)
Now get_data can be a class which can have different function for various callback
The component html contain static HTML like you want to return a
textbox when a user click a button.
from view page write a callback that will call a function on the controller that wil return an static html into the div.
Keeping everything organized will help you getting into conflicts which you are getting right now.
It was really messy, i have the feeling that it now runs faster,
Another thing that i found that may be also the cause of the trouble. When the app is still running ( like updating a graphic) and I click in another tab, it may cause the clicked tab not downloading properly.
@monitorcasalab are you using my folder structure ?
as per the second part I guess it will not be an issue, although I am not sure but I did not faced this issue even when my view was under a callback changing tabs was not a problem.
Also, I have tried to use urls to get the data clustering functionality. But no luck.
Requirement is - to create sections for each type of data so when user clicks on any section and see the respective files.
But for some reason the files from the folder are not showing up upon page click