This repository was archived by the owner on Jun 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 301
/
Copy pathsearchQueryTest.py
66 lines (55 loc) · 1.85 KB
/
searchQueryTest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import dash
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_core_components as dcc
app = dash.Dash()
server = app.server
app.config.suppress_callback_exceptions = True
app.scripts.config.serve_locally = True
layout = html.Div([
html.H3('App 1'),
dcc.Dropdown(
id='app-1-dropdown',
options=[
{'label': 'App 1 - {}'.format(i), 'value': i} for i in [
'NYC', 'MTL', 'LA'
]
]
),
html.Div(id='app-1-display-value'),
dcc.Link('Go to App 2', href='/apps/app2'),
html.Div(id='searchRes1'),
])
@app.callback(
Output('app-1-display-value', 'children'),
[Input('app-1-dropdown', 'value')])
def display_value(value):
return 'You have selected "{}"'.format(value)
app.layout = html.Div([dcc.Location(id='url', refresh=False),
html.Div(id='searchRes2'),
html.H1('Test'),
html.Div(id='page-content')])
app.css.append_css({
'external_url': 'https://codepen.io/chriddyp/pen/bWLwgP.css'
})
@app.callback(Output('page-content', 'children'),
[Input('url', 'pathname')])
def display_page(pathname):
print('display_page')
return layout
@app.callback(Output('searchRes1', 'children'),
[Input('url', 'search')])
def display_value(search):
print('searchRes1')
if search is None or search is '':
return 'no Search'
return 'searchRes1: {}'.format(search)
@app.callback(Output('searchRes2', 'children'),
[Input('url', 'search')])
def display_value(search):
print('searchRes2')
if search is None:
return 'no search'
return 'searchRes2: {}'.format(search)
if __name__ == '__main__':
app.run_server(debug = True) #host = '0.0.0.0', port=8051)