Skip to content

Commit

Permalink
Add search word onEnter
Browse files Browse the repository at this point in the history
  • Loading branch information
pbong committed Oct 31, 2023
1 parent 9c3a10a commit 1ff3f40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/callbacks/home/home_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ def init_callback(app):
Output('home-sidebar', 'hidden'),
Output('submitted-word', 'data'),
Input('search-word-submit-btn', 'n_clicks'),
Input('search-word', 'n_submit'),
State('search-word', 'value')
)
def submit_input(n_clicks, word):
if n_clicks >= 1:
def submit_input(n_clicks, n_submit, word):
if n_clicks >= 1 or n_submit >= 1:
return False, False, word.lower()

raise PreventUpdate
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
html.Br(),
dbc.InputGroup([
html.Br(),
dbc.Input(id='search-word'),
dbc.Input(id='search-word', n_submit=0),
dbc.Button('Search', color='dark',
id='search-word-submit-btn', n_clicks=0)
], style={'width': '60%'})
Expand Down

0 comments on commit 1ff3f40

Please sign in to comment.