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

multi-select does not work #1791

Closed
signup2k opened this issue Sep 9, 2023 · 2 comments
Closed

multi-select does not work #1791

signup2k opened this issue Sep 9, 2023 · 2 comments

Comments

@signup2k
Copy link

signup2k commented Sep 9, 2023

Multi-select does not work, neither with the example listed on document's selector section, nor with the example code I copy and run on local machine.

update::

I find the multselect.py and select.py both in the reflex component.
The example given in the document, use rx.select only, even with multiselect example.

When I check the select.py file, the props in Select Class does not have is_multi, close_menu_on_select, etc. Which can be found in multiselect.py file.

But when I use rx.multi_select(), the Error message will be

11, in
lambda e0: [Var.create_safe(f"{e0}.map(e => e.value)", is_local=True)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/joeyjiang/opt/anaconda3/envs/py311/lib/python3.11/site-packages/reflex/vars.py", line 238, in bool
raise TypeError(
TypeError: Cannot convert Var 'true' to bool for use with if, and, or, and not. Instead use rx.cond and bitwise operators & (and), | (or), ~ (invert).

And I guess, the reflex mixed the select.py and multiselect.py when create Select instance (because in both select.py and multiselect.py file, the class name are the same Select).

I dont know how to fix this.

@masenf
Copy link
Collaborator

masenf commented Sep 24, 2023

@signup2k see #1861... this component is going to need a lot more work to make it nice, but that PR makes it functional

@signup2k
Copy link
Author

@masenf Thank you for your detail explaination. #1861 works for me now. But as you said, this component do need a lot more work to make it nice.

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