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

feat: ionCheck and ionUncheck for ion-checkbox #19096

Closed
mahnuh opened this issue Aug 14, 2019 · 4 comments
Closed

feat: ionCheck and ionUncheck for ion-checkbox #19096

mahnuh opened this issue Aug 14, 2019 · 4 comments
Labels
needs: reply the issue needs a response from the user

Comments

@mahnuh
Copy link

mahnuh commented Aug 14, 2019

Feature Request

Ionic version:
[x] 4.x

Describe the Feature Request
I want to be able to trigger something when a checkbox is being checked/unchecked. ionChange does not work in some cases, see additional context below.

Describe Preferred Solution
Extend events on ion-checkbox to have ionCheck and ionUncheck, similar to ionSelect and ionDeselect on ion-radio.

Related Code
Working on a PR at the moment.

Additional Context
Let's say I have a list of items. Those items are custom components with a couple of checkboxes each. The data for this list comes from an observable I subscribed to. I use ionChange to detect if one of those checkboxes is being checked/unchecked and the previously mentioned observable is being triggered. This triggers ionChange again which then triggers the observable which then triggers ionChange... and now I am trapped in a pretty nasty endless loop.
I guess there could be more cases when you do not want do use ionChange to determine if a specific checkbox is being checked/unchecked.

@Sacrekin
Copy link

With Vue, I made it work with the @click.native event. Basically, Checkboxes need a click event in ionic.
<IonCheckboxVue v-model="user.check[index].val" @click.native="unCheckBoxes(index)"></IonCheckboxVue>

@mahnuh
Copy link
Author

mahnuh commented Aug 15, 2019

Yes, that is kind of what I did with my pull request.

@averyjohnston
Copy link
Contributor

Hello, thanks for the issue. We have another issue here #20106 to track the bug with the infinite loop on ionChange. I know it's been a while, but if that one is resolved, would that take care of your use case? Or was there anything else preventing you from using ionChange and checking the checked property?

@averyjohnston averyjohnston added the needs: reply the issue needs a response from the user label Feb 2, 2022
@ionitron-bot ionitron-bot bot removed the triage label Feb 2, 2022
@ionitron-bot
Copy link

ionitron-bot bot commented Feb 16, 2022

Thanks for the issue! This issue is being closed due to the lack of a reply. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Thank you for using Ionic!

@ionitron-bot ionitron-bot bot closed this as completed Feb 16, 2022
@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Feb 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: reply the issue needs a response from the user
Projects
None yet
Development

No branches or pull requests

3 participants