angular2-multiselect-dropdown icon indicating copy to clipboard operation
angular2-multiselect-dropdown copied to clipboard

Not fully working on Angular 12, list items disappear.

Open cbrusca opened this issue 2 years ago • 4 comments

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?

cbrusca avatar Oct 20 '21 18:10 cbrusca

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.

cbrusca avatar Oct 20 '21 19:10 cbrusca

Thanks @cbrusca same problem here

iamandreadompe avatar Nov 25 '21 11:11 iamandreadompe

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.

m12lrpv avatar May 02 '22 23:05 m12lrpv

I am facing the same issue.

MPeli avatar May 31 '22 13:05 MPeli