Using latest releases of Angular and Ignite UI (12.0.3):
I have a pair of Dropdowns using the igx-input-group model. One of them determines the filtered data set of the second. I am using the (onSelection) attribute to filter the second, but I am also getting an error NG0100: ExpressionChangedAfterItHasBeenCheckedError.
The functionality isn't broken, but it's throwing an error like it is. If I didn't have tech savvy users who will complain, I wouldn't bother asking how to fix it.
A previous question suggested using markForCheck on the igx-grid component. Is there something similar for this setup I should be using, either on the dropdown or the input-group? This is in a dialog modal, if that makes any difference.
Hello Chris,
Thank you for getting back to me!
I’m glad that you have managed to achieve your requirements.
Thank you for using Infragistics Components!
Best Regards, Martin Evtimov Associate Software Developer Infragistics, Inc.
That works, slightly differently than implemented (I used e.newValue !== undefined) to process new values.
Please note that currently, by design, the onSelection event is emitted when the selectedItem of the igxDropDown Component has been changed through user interaction or via the selectItem API method.
My suggestion would be to log this behavior in our GitHub repository here. This will give you the opportunity do directly communicate with our development team regarding the issue and get notifications whenever a new information is available.
Additionally another possible approach could be to use a conditional flag within the different lifecycle hooks in order to determinate whether the event has been emitted because of the preselection. Please keep in mind that initially the oldSelection filed of the onSelection event args is null. You can refer to the following sample I have prepared for you.
Please let me know if you need any further information!
Ok, so I've rooted out another issue related to dropdowns. The (onSelection) is firing when it's being created because it is being pre-populated with a value. Is there a way to prevent the onSelection action during render?
I have a grid that waits for user input to populate, but one of the dropdowns fires on render and on occasion, the grid populates without interaction, and without any useful data. I'm hoping to prevent this for improved user experience.
I’m glad that you find the provided information helpful.
Best Regards,Martin EvtimovAssociate Software DeveloperInfragistics, Inc.