ng2-iq-select2
ng2-iq-select2 copied to clipboard
Reinitialize the component with new dataSourceProvider function
I was trying to show the ng2-iq-select2 options based on another ng2-iq-select2 selection. First time everything is working fine. But when i try to change the value of first one, the second drop down options will not change due to clientMode option set as true(i need to do it in client side). Is there any way to reinitialize the component with new dataSourceProvider function?
I haven't tried but I think you should be able to do something like select2ComponentVariable.fullDataList = undefined;
when you make the selection on the first component. There is a onSelect
event generated that may be useful for that. Obviously, this isn't as elegant as I wanted it to be, but I think it should be a valid workaround. Will try to add a handy method to reset the loaded values manually for this cases.
You can return a Subject from your dataSourceProvider and then just call subject.next([your new data array here]). We did this at work and it works like a charm :)