angular2-multiselect-dropdown
angular2-multiselect-dropdown copied to clipboard
Not fully working on Angular 12, list items disappear.
I'll try to explain what's happening. If I keep opening and closing the dropdown list, eventually the data just disappears and just says "No Data Available". The data also disappears if I try to search for something that would have results, even if I clear my search, the data is now gone until I refresh the screen.
Any fixes for this?
I found a workaround solution, if I make a deep copy of the array I'm using and use that instead of the primary array, it works fine.
Example: this.sortedClients2 = [...this.sortedClients];
Both of these arrays start empty, [], and sortedClients is loaded in ngOnInit(), only now I added the code above to the end of the ngOnInit() function and it's no longer disappearing on searching or randomly.
This probably isn't the most elegant solution, but it works for now.
Thanks @cbrusca same problem here
It almost looks like this bug was reintroduced... https://github.com/CuppaLabs/angular2-multiselect-dropdown/issues/212
Edit... For me the dropdown was clearing on (onDeSelectAll) even though the bound list wasn't changed.
<angular2-multiselect id="networks"
[data]="networkDropdownList"
[settings]="this.networkDropdownSettings" (onSelect)="onNetworkItemSelect($event)"
(onDeSelect)="OnNetworkItemDeSelect($event)"
(onSelectAll)="onNetworkSelectAll($event)"
(onDeSelectAll)="onNetworkDeSelectAll($event)" formControlName="Network">
</angular2-multiselect>
onNetworkDeSelectAll(event) {
this.formGroup.controls['Network'].setValue([]);
// This fixed the issue for me.
this.networkDropdownList = [...this.networkDropdownList];
}
Just doing a deep copy of the bound list back into itself seemed to repopulate it.
I am facing the same issue.