Namespacing des dcc.Location pour éviter les conflits entre pages
This commit is contained in:
+2
-2
@@ -25,7 +25,7 @@ register_page(
|
||||
layout = [
|
||||
dcc.Store(id="marche_data"),
|
||||
dcc.Store(id="titulaires_data"),
|
||||
dcc.Location(id="url", refresh="callback-nav"),
|
||||
dcc.Location(id="marche_url", refresh="callback-nav"),
|
||||
dbc.Container(
|
||||
className="marche_infos",
|
||||
children=[
|
||||
@@ -73,7 +73,7 @@ layout = [
|
||||
@callback(
|
||||
Output("marche_data", "data"),
|
||||
Output("titulaires_data", "data"),
|
||||
Input(component_id="url", component_property="pathname"),
|
||||
Input(component_id="marche_url", component_property="pathname"),
|
||||
)
|
||||
def get_marche_data(url) -> tuple[dict, list]:
|
||||
marche_uid = url.split("/")[-1]
|
||||
|
||||
@@ -47,7 +47,7 @@ datatable = html.Div(
|
||||
)
|
||||
|
||||
layout = [
|
||||
dcc.Location(id="url", refresh=False),
|
||||
dcc.Location(id="tableau_url", refresh=False),
|
||||
html.Div(
|
||||
html.Details(
|
||||
children=[
|
||||
@@ -190,8 +190,8 @@ def download_data(n_clicks, filter_query, sort_by, hidden_columns: list = None):
|
||||
Output("table", "filter_query"),
|
||||
Output("table", "sort_by"),
|
||||
Output("table", "hidden_columns"),
|
||||
Output("url", "search", allow_duplicate=True),
|
||||
Input("url", "search"),
|
||||
Output("tableau_url", "search", allow_duplicate=True),
|
||||
Input("tableau_url", "search"),
|
||||
prevent_initial_call=True,
|
||||
)
|
||||
def restore_view_from_url(search):
|
||||
@@ -228,7 +228,8 @@ def restore_view_from_url(search):
|
||||
Input("table", "filter_query"),
|
||||
Input("table", "sort_by"),
|
||||
Input("table", "hidden_columns"),
|
||||
State("url", "href"),
|
||||
State("tableau_url", "href"),
|
||||
prevent_initial_call=True,
|
||||
)
|
||||
def sync_url_and_reset_button(filter_query, sort_by, hidden_columns, href):
|
||||
if not href:
|
||||
|
||||
@@ -47,7 +47,7 @@ datatable = html.Div(
|
||||
|
||||
layout = [
|
||||
dcc.Store(id="titulaire_data", storage_type="memory"),
|
||||
dcc.Location(id="url", refresh="callback-nav"),
|
||||
dcc.Location(id="titulaire_url", refresh="callback-nav"),
|
||||
html.Div(
|
||||
children=[
|
||||
html.Div(
|
||||
@@ -152,7 +152,7 @@ layout = [
|
||||
Output(component_id="titulaire_departement", component_property="children"),
|
||||
Output(component_id="titulaire_region", component_property="children"),
|
||||
Output(component_id="titulaire_lien_annuaire", component_property="href"),
|
||||
Input(component_id="url", component_property="pathname"),
|
||||
Input(component_id="titulaire_url", component_property="pathname"),
|
||||
)
|
||||
def update_titulaire_infos(url):
|
||||
titulaire_siret = url.split("/")[-1]
|
||||
@@ -219,7 +219,7 @@ def update_titulaire_stats(data):
|
||||
Output("btn-download-data-titulaire", "disabled"),
|
||||
Output("btn-download-data-titulaire", "children"),
|
||||
Output("btn-download-data-titulaire", "title"),
|
||||
Input(component_id="url", component_property="pathname"),
|
||||
Input(component_id="titulaire_url", component_property="pathname"),
|
||||
Input(component_id="titulaire_year", component_property="value"),
|
||||
)
|
||||
def get_titulaire_marches_data(url, titulaire_year: str) -> tuple:
|
||||
|
||||
Reference in New Issue
Block a user