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

emit-value in ui.select #4139

Closed
TM0088 opened this issue Dec 24, 2024 · 1 comment
Closed

emit-value in ui.select #4139

TM0088 opened this issue Dec 24, 2024 · 1 comment

Comments

@TM0088
Copy link

TM0088 commented Dec 24, 2024

Description

When putting dict {'value1':'label1',....} in options and .props('v-model="model" :options="options" emit-value') in ui.select, the ' emit-value' function is not working as expected and cause error of typeerror in select.py.

In Quasar document (https://quasar.dev/vue-components/select), nested dict is allowed to be passed to handle different feature like adding badges and icons.
[{
label: 'Google',
value: 'goog',
description: 'Search engine',
icon: 'mail'
},]

options_in_dict_format = {'value1':'label1','value2':'label2'}
ui.select(options=options_in_dict_format, with_input=True, label='select_label',
          on_change=lambda e: ui.notify(e.value)) \
    .props('v-model="model" :options="options" emit-value')
Traceback (most recent call last):
  File "C:\Users\T\AppData\Local\Programs\Python\Python312\Lib\site-packages\nicegui\events.py", line 411, in handle_event
    result = handler(arguments) if expects_arguments else handler()
             ^^^^^^^^^^^^^^^^^^
  File "C:\Users\T\AppData\Local\Programs\Python\Python312\Lib\site-packages\nicegui\elements\mixins\value_element.py", line 40, in handle_change
    self.set_value(self._event_args_to_value(e))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\T\AppData\Local\Programs\Python\Python312\Lib\site-packages\nicegui\elements\select.py", line 110, in _event_args_to_value
    return self._values[e.args['value']]
                        ~~~~~~^^^^^^^^^
TypeError: 'int' object is not subscriptable

Is there any work-around/fix for the situation? Thank you very much!

@falkoschindler
Copy link
Contributor

Hi @TM0088,

Have you seen #3977?
Since this is a known limitation of ui.select rather than a bug, I'll close this issue.

@falkoschindler falkoschindler closed this as not planned Won't fix, can't repro, duplicate, stale Jan 6, 2025
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