Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,7 +18,7 @@ of cross-filtering.
|
|
| 18 |
text = pn.pane.Markdown(instructions)
|
| 19 |
|
| 20 |
# List to store the entered options
|
| 21 |
-
entered_options = []
|
| 22 |
|
| 23 |
# MultiChoice widget to display the filter options
|
| 24 |
filter_list = pn.widgets.MultiChoice(
|
|
@@ -33,23 +33,19 @@ filter_list = pn.widgets.MultiChoice(
|
|
| 33 |
# "+" button to show the search options
|
| 34 |
add_option_button = pn.widgets.Button(icon='search', name="", icon_size='2em', width=60, height=30)
|
| 35 |
|
| 36 |
-
#
|
| 37 |
-
new_option_input = pn.widgets.TextInput(sizing_mode="stretch_width", background='lightgrey')
|
| 38 |
-
|
| 39 |
-
# Callback for the "+" button to add the new option to the filter list
|
| 40 |
def add_new_option(event):
|
| 41 |
-
|
| 42 |
-
if
|
| 43 |
-
entered_options.
|
| 44 |
filter_list.options = entered_options # Update the filter_list options
|
| 45 |
-
new_option_input.value = ""
|
| 46 |
|
| 47 |
add_option_button.on_click(add_new_option)
|
| 48 |
|
| 49 |
# Layout using Template
|
| 50 |
template = pn.template.FastListTemplate(
|
| 51 |
title="EasySciRead",
|
| 52 |
-
header=[pn.Row(filter_list, add_option_button
|
| 53 |
sidebar=[buttons],
|
| 54 |
main=[
|
| 55 |
pn.Column(text),
|
|
|
|
| 18 |
text = pn.pane.Markdown(instructions)
|
| 19 |
|
| 20 |
# List to store the entered options
|
| 21 |
+
entered_options = ["option1", "option2", "option3"]
|
| 22 |
|
| 23 |
# MultiChoice widget to display the filter options
|
| 24 |
filter_list = pn.widgets.MultiChoice(
|
|
|
|
| 33 |
# "+" button to show the search options
|
| 34 |
add_option_button = pn.widgets.Button(icon='search', name="", icon_size='2em', width=60, height=30)
|
| 35 |
|
| 36 |
+
# Callback for the "+" button to add the selected option to the filter list
|
|
|
|
|
|
|
|
|
|
| 37 |
def add_new_option(event):
|
| 38 |
+
selected_option = filter_list.value
|
| 39 |
+
if selected_option:
|
| 40 |
+
entered_options.remove(selected_option[0]) # Remove the selected option from the list
|
| 41 |
filter_list.options = entered_options # Update the filter_list options
|
|
|
|
| 42 |
|
| 43 |
add_option_button.on_click(add_new_option)
|
| 44 |
|
| 45 |
# Layout using Template
|
| 46 |
template = pn.template.FastListTemplate(
|
| 47 |
title="EasySciRead",
|
| 48 |
+
header=[pn.Row(filter_list, add_option_button)],
|
| 49 |
sidebar=[buttons],
|
| 50 |
main=[
|
| 51 |
pn.Column(text),
|