Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,6 +47,7 @@ def update_header():
|
|
| 47 |
header_buttons.clear() # Clear the existing buttons
|
| 48 |
for button_name in buttons_to_add:
|
| 49 |
header_button = pn.widgets.Button(name=button_name, width=50, sizing_mode='fixed')
|
|
|
|
| 50 |
header_button.on_click(remove_from_header) # Add callback to remove the header button
|
| 51 |
header_buttons.append(header_button)
|
| 52 |
|
|
@@ -63,7 +64,7 @@ filter_list = pn.widgets.MultiChoice(
|
|
| 63 |
|
| 64 |
# Callback to remove the clicked header button and add it back to the filter list options
|
| 65 |
def remove_from_header(event):
|
| 66 |
-
button_name = event.
|
| 67 |
filter_list.options.append(button_name) # Add back to the filter list options
|
| 68 |
buttons_to_add.remove(button_name) # Remove from the header buttons list
|
| 69 |
update_header() # Update the header and filter list
|
|
|
|
| 47 |
header_buttons.clear() # Clear the existing buttons
|
| 48 |
for button_name in buttons_to_add:
|
| 49 |
header_button = pn.widgets.Button(name=button_name, width=50, sizing_mode='fixed')
|
| 50 |
+
header_button.param.custom_name = button_name # Add custom attribute to store button name
|
| 51 |
header_button.on_click(remove_from_header) # Add callback to remove the header button
|
| 52 |
header_buttons.append(header_button)
|
| 53 |
|
|
|
|
| 64 |
|
| 65 |
# Callback to remove the clicked header button and add it back to the filter list options
|
| 66 |
def remove_from_header(event):
|
| 67 |
+
button_name = event.obj.param.custom_name # Get the custom attribute to identify the button
|
| 68 |
filter_list.options.append(button_name) # Add back to the filter list options
|
| 69 |
buttons_to_add.remove(button_name) # Remove from the header buttons list
|
| 70 |
update_header() # Update the header and filter list
|