Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
How to clear the selection of a IgxDropDownComponent?
posted

Hi.


I would like to clear a Dropdown selection.

The "setSelectedItem" function of IgxDropDownComponent only accepts values between the Ids of the Dropdown Items list (https://github.com/IgniteUI/igniteui-angular/blob/b74de693f1/projects/igniteui-angular/src/lib/drop-down/drop-down.component.ts#L265).. As such, setting the value to "-1" or "undefined" / "null" has no effect.

Shouldn't there be a more elegant solution instead of calling ngOnDestroy() on the component for something as simple as clearing a selection?

Thank you for your time.


Regards,
Cornel Stoica