Toga Selection widget #1576
Replies: 2 comments
-
The best option I can give you right now is to construct your data as a dictionary:
Then pass that data to the selection widget as the data. When the item is selected, you'll get back the label; use that to look up the primary key in the data. Longer term, the intention is to allow you to pass any object with a |
Beta Was this translation helpful? Give feedback.
-
Thanks, that’s great - although it’s good to hear there’s a longer term solution in the pipeline as well, just in case somebody manages to use the same label twice in the source table!
On 25 Aug 2022, at 23:44, Russell Keith-Magee ***@***.***> wrote:
The best option I can give you right now is to construct your data as a dictionary:
data = {
'label 1': 15,
'label 2': 16,
'label 3': 17,
}
Then pass that data to the selection widget as the data. When the item is selected, you'll get back the label; use that to look up the primary key in the data.
Longer term, the intention is to allow you to pass any object with a __str__ to the selection, so you can associate the primary key directly with the selected item. We also want to allow the use of "ListSource" objects, similar to how a Table view works, so that the data can be completely abstracted from the widget.
—
Reply to this email directly, view it on GitHub <#1576 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AIZGES7ROPYCQE5XJQQ6KEDV27ZNRANCNFSM57UCOKTA>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
Good evening
Is there a way of adding a second, hidden, field to an item in a selection widget, like a primary key?
Thanks
Chris
Beta Was this translation helpful? Give feedback.
All reactions