-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Ionic v4: Re-add compareWith property to ion-select #14598
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
Comments
compareWith
property to ion-select
Just go over this file : https://github.com/ionic-team/ionic/blob/master/core/src/components/select/select.tsx and set:
Then build again the core with the |
@izio38 I wish it were that easy! 😅 For starters, I'm not sure how the option elements and the select play together, as they now emit a That's why I decided to open this issue instead of a PR. Thanks, |
same problem, need compareWith to work with objects! |
Has there been any more work on this? I too need compareWith to work with objects. @FdezRomero are you saying izio38 solution won't work? If not did you find a work around, do you mind sharing it? |
@bkarv No, that code wouldn't work with the current codebase. You can try it yourself by cloning the repo and modifying the source. You'll see all the TypeScript errors about missing properties. I talked about this some time ago with @manucorporat and there wasn't a straightforward solution. I ended up using form components from Angular Material instead, since they are better suited for my use case (a desktop PWA). |
Thanks for the prompt response. I looked at Angular Material, did you mean you gave up on Ionic all together or just imported Angular Material's form components/library into your Ionic app? It is disappointing this has not been implemented as I would say many would need object support in ion-select |
@bkarv Not disappointing at all. That's what betas are made for! Finding things that are missing or not working as expected and reporting them 😄 I didn't drop Ionic, just replaced inputs and selects for the ones in Angular Material, since the drop-down select style suited by app better anyway. |
@FdezRomero sorry misunderstood! Ok well fingers crossed a solution is found. |
@FdezRomero @izio38 @matheusdavidson I needed compareWith because had an array of objects as my select options eg After digging around I found this post where we can use trackBy instead Tried it in Ionic 4 -beta 8 and it works like a charm! If anything trackBy feature is better than compareWith as I don't have to define the function. Here is a working example below: Controller
Html
|
Same problem! And the trackBy suggested by @bkarv is not working on beta15. |
+1 This is definitely needed again. |
Any updates in this matter? trackBy is not working on rc3 too. |
+1 on this. I needed this consistently as I am working on an application with about 30 selects |
I'm hoping to create a PR for this fairly soon. Stay tuned! |
Put in a PR for this finally. |
When will this be merged? |
Hi everyone, This has been fixed by #17358 and will be in the next release of Ionic. Thanks for your patience! |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. 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. |
Bug Report
Ionic Info
Run
ionic info
from a terminal/cmd prompt and paste the output below.Describe the Bug
ion-select
is missing thecompareWith
Angular property in ionic-angular v4, previously working in v3 with PR #11965.Steps to Reproduce
Steps to reproduce the behavior:
<ion-select>
element with[compareWith]="compareFunction"
.Related Code
If you are able to illustrate the bug with an example, please provide a sample application via an online code collaborator such as StackBlitz, or GitHub.
Expected Behavior
To be able to bind to
compareWith
in an ion-select.Additional Context
Angular docs for compareWith
The text was updated successfully, but these errors were encountered: