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

Cannot use different value and text in CombBox #117

Open
12rambau opened this issue Dec 23, 2020 · 5 comments
Open

Cannot use different value and text in CombBox #117

12rambau opened this issue Dec 23, 2020 · 5 comments

Comments

@12rambau
Copy link
Contributor

If I read the documentation of Combobox, The items property can be a list of dict as :

{
  text: string | number | object,
  value: string | number | object,
  disabled: boolean,
  divider: boolean,
  header: string
}

when I use it in a ipyvuetify as such :

climate_regimes = [
    {'text': 'Temperate dry (coef = 0.8)',    'value': 0.80},
    {'text': 'Temperate moist (coef = 0.69)', 'value': 0.69},
    {'text': 'Tropical dry (coef = 0.58)',    'value': 0.58},
    {'text': 'Tropical moist (coef = 0.48)',  'value': 0.48},
    {'text': 'Tropical montane (coef = 0.64)','value': 0.64}
]

tutu = v.ComboBox(items=climate_regimes, v_model=None)

but when I check tutu.v_model after selecting the first option, I get: {'text': 'Temperate dry (coef = 0.8)', 'value': 0.80}instead of the expected 0.8

@mariobuikhuizen
Copy link
Collaborator

This is how Vuetify works, ipyvuetify does not change this.

This makes it not very usable with link. We could make a special link version in which you can specify a conversion function.

@12rambau
Copy link
Contributor Author

12rambau commented Dec 23, 2020

Are you sure that it's normal vuetify behaviour ?
Because if I do the same in a select :

tutu = v.Select(items=climate_regimes, v_model=None)

then tutu.v_model has the expected 0.8value. Both api component have the same doc regarding the items prop

@mariobuikhuizen
Copy link
Collaborator

It's indeed different for Select. I see now it's because of the prop return-object that has a different default.

@mariobuikhuizen
Copy link
Collaborator

Is this solved by setting return-object to False on Combobox?

@12rambau
Copy link
Contributor Author

12rambau commented Jan 6, 2021

yes and no.

with :

tutu = v.Combobox(items=climate_regimes, v_model=None, return_object = False)

I effectively get the value field in the tutu.v_model but then what's written in the combobox is not the text field of the dictionary but simply the v_model which is not the behaviour observed with the Select component

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