My intention is to use two dropdown components to filter on a table. When I select an item from the first one, let’s say region, a second dropdown is shown and lists only cities in the chosen previous selection. Now I should be able to select a city. Unfortunately, if there is only one city, it cannot be selected. This seems to be a bug.
Here is an example code:
CLIENT:
from ._anvil_designer import Form1Template
from anvil import *
import anvil.server
class Form1(Form1Template):
def init(self, **properties):
self.init_components(**properties)
self.dropdown_1.items = anvil.server.call(‘get_dropdown_data’)
def dropdown_1_change(self, **event_args):
print(self.dropdown_1.selected_value)
SERVER:
import anvil.server
@anvil.server.callable
def get_dropdown_data():
#return [“Option 1”, “Option 2”, “Option 3”] # works
return [“Option 1”] # cannot select Option 1 any more…