Hello,
I am trying to get the string of the path by using dcc,Location, but instead a list is being returned. Is there a way I can just get a string by using dcc.location
Example:
layout = html.Div([
dcc.Location(id="url1", refresh=True)
], id="404")
@app.callback(
Output("url1", "pathname"),
Input("404", "children")
)
def checkID(url):
global df
print(url)
url = str(url)
url = url.replace("/", "")
for i,row in df.iterrows():
crimeId = str(row.CrimeID)
if url == crimeId:
return mapPublic.layout
raise PreventUpdate
What is printed:
[{'props': {'id': 'url1', 'refresh': True, 'pathname': '/4102021Chelmsford', 'href': 'http://10.0.0.178:8050/4102021Chelmsford', 'hash': '', 'search': ''}, 'type': 'Location', 'namespace': 'dash_core_components'}]
Thank you