Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple autocomplete items event handling #21

Open
vpet98 opened this issue Nov 22, 2023 · 1 comment
Open

Multiple autocomplete items event handling #21

vpet98 opened this issue Nov 22, 2023 · 1 comment

Comments

@vpet98
Copy link

vpet98 commented Nov 22, 2023

When there are more than one Autocomplete items in an App, is there a way to handle events only for the item that caused the event?

Currently, from within handler on_auto_complete_selected(self, event) I think there is no way to distinguish from which item the event was caused and take appropriate action, because the event itself does not contain such information.

So, all my autocomplete items will have the same event handling, but that is something that might not be the desired behavior.

@ChangedUser
Copy link

Had the same problem.
This can be resolved by using the additional meta fields (event.item.left_meta) which can be inserted while you fill your DropdownItem List (takes up to three arguments, main, left_meta and right_meta)
This way you can check in the on_auto_complete_select function which event this is coming from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants