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

When select is rendered it should not fire onChange action if value property is equal to null or undefined #246

Open
enterpub opened this issue Jun 26, 2019 · 2 comments

Comments

@enterpub
Copy link

enterpub commented Jun 26, 2019

Version of x-select: 4.0.0-beta.2

Ember Version: 3.10.2
Ember CLI Version: 3.10.1

I think when select is rendered it should not fire onChange action if the value property is equal to null or undefined. BTW, if value property is equal to anything else, than null or undefined the onChange action does not fire.
For example, I have a list of insurance types:

<XSelect @value={{this.insuranceTypeId}} @onChange={{action "showInsuranceTypePopup"}} as |xs|>
    <xs.option>None</xs.option>
    <xs.option @value=1>Medicare</xs.option>
    <xs.option @value=2>Medicaid</xs.option>
    <xs.option @value=3>Tricare Champus</xs.option>
    <xs.option @value=4>Champva</xs.option>
    <xs.option @value=5>Group Health Plan</xs.option>
    <xs.option @value=6>FECA Black Lung</xs.option>
    <xs.option @value=7>Other</xs.option>
</XSelect>

The initial value of 'this.insuranceTypeId' is equal to null, because no of the license is chosen and this is normal. But the addon fires onChange action. I do not get it why? Nothing changed. In my case it brings an issue, because implementation of showInsuranceTypePopup action shows a popup, so my users, when page has been loaded, have to close the popup first, then do what they want. In every such case, I have to workaround this issue.
In emberx-select version 3.x it did not fire the event, now it does.

What do you think?

@enterpub enterpub changed the title When select is rendered it should not fire onChange action if the value property is equal to null or undefined When select is rendered it should not fire onChange action if value property is equal to null or undefined Jun 26, 2019
@corrspt
Copy link

corrspt commented Jul 27, 2019

Seeing the same thing. It confused me as it had a weird behavior in my app.

@aandis
Copy link

aandis commented May 8, 2020

+1

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

3 participants