I’m currently using the basic method from the example video to populate my first drop-down
self.dd.items = [(r['name'], r) for r in app_tables.stuff.search()]
from here i need a second drop-down to show the other column values from the first selection.
full code would look something like:
self.dd.items = [(r['name'], r) for r in app_tables.stuff.search()]
def dd_change(self, **event_args):
self.dd2.items = ---selected row, cells for value1 and value2---
dd is drop down 1
dd2 is drop down 2
stuff is the data table (col = name, value1, value2)
It seems like value1 and value2 are dependent on the selection in dd? So I don’t think I would use a second DropDown unless you want to be able to make selections with it…
I have a couple of suggestions. You could change the dd.items property to be as follows:
self.dd.items = [(f"{r['name']} - {r['value1']} - {r['value2']}", r) for r in app_tables.stuff.search()]
This way the displayed option is the name, value1 and value2 and the row is what is selected.
Alternatively keep the current approach but have two Labels next to the dropdown. Change their text property on the dd_change event.
self.dd.items = [(r['name'], r) for r in app_tables.stuff.search()]
def dd_change(self, **event_args):
row = dd.selected_value
self.label_value1.text = row["value1"]
self.label_value2.text = row["value2"]
yea just to clarify, i need to select form Value1 and Value2 in the second dropdown. This looks like it might solve my problem. Gonna try implementing and see where we get