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

resetting list of options when text input field becomes empty #74

Closed
hunterboerner opened this issue Jun 22, 2024 · 4 comments
Closed

Comments

@hunterboerner
Copy link

When options are cleared I want to show the initial full selection list. However currently the live_select_id is not sent with the options_clear event so I cannot reset the live select form. My workaround is to store the last live_select_id and then clear that with the options_clear event but I'm not sure this will work if I have multiple live selects on the same page.

@maxmarcon
Copy link
Owner

Thanks, I understand the use case here. However, the options_clear event is internal to LiveSelect, and you would not be able to handle it in your live view/component. However, your description sounds like you are able to handle it. Can you please clarify how?

One idea would be to send the options_clear event also to the live view/component that renders LiveSelect, with the id as you suggest

@maxmarcon maxmarcon added the enhancement New feature or request label Jun 22, 2024
@hunterboerner
Copy link
Author

hunterboerner commented Jun 22, 2024 via email

@maxmarcon maxmarcon changed the title options_clear should include the live_select_id resetting list of options when text input field becomes empty Jun 23, 2024
@maxmarcon
Copy link
Owner

Does this cheatsheet work for you?

@maxmarcon
Copy link
Owner

It should work, I created it exactly to implement this use case

@maxmarcon maxmarcon removed the enhancement New feature or request label Jun 25, 2024
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