EasySci commited on
Commit
080bf38
·
1 Parent(s): 50964b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -17,11 +17,14 @@ of cross-filtering.
17
 
18
  text = pn.pane.Markdown(instructions)
19
 
 
 
 
20
  # Add filter list row with spacing
21
  filter_list = pn.widgets.CheckButtonGroup(
22
  name='Filter Options',
23
  margin=(20, 10),
24
- options=[],
25
  sizing_mode='fixed',
26
  button_type='default'
27
  )
@@ -34,9 +37,9 @@ new_option_input = pn.widgets.TextInput(sizing_mode="stretch_width", background=
34
 
35
  # Callback for the "+" button to add the new option to the filter list
36
  def add_new_option(event):
37
- new_option = new_option_input.value
38
  if new_option:
39
- filter_list.options = new_option_input.value.split(',') # Split the comma-separated input into a list
40
  new_option_input.value = ""
41
 
42
  add_option_button.on_click(add_new_option)
 
17
 
18
  text = pn.pane.Markdown(instructions)
19
 
20
+ # List to store the entered options
21
+ entered_options = []
22
+
23
  # Add filter list row with spacing
24
  filter_list = pn.widgets.CheckButtonGroup(
25
  name='Filter Options',
26
  margin=(20, 10),
27
+ options=entered_options, # Use the list of entered options
28
  sizing_mode='fixed',
29
  button_type='default'
30
  )
 
37
 
38
  # Callback for the "+" button to add the new option to the filter list
39
  def add_new_option(event):
40
+ new_option = new_option_input.value.strip() # Remove leading/trailing spaces
41
  if new_option:
42
+ entered_options.append(new_option) # Add the option to the list of entered options
43
  new_option_input.value = ""
44
 
45
  add_option_button.on_click(add_new_option)