Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not fully working on Angular 12, list items disappear. #592

Open
cbrusca opened this issue Oct 20, 2021 · 4 comments
Open

Not fully working on Angular 12, list items disappear. #592

cbrusca opened this issue Oct 20, 2021 · 4 comments

Comments

@cbrusca
Copy link

cbrusca commented Oct 20, 2021

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
Copy link
Author

cbrusca commented Oct 20, 2021

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.

@iamandreadompe
Copy link

Thanks @cbrusca
same problem here

@m12lrpv
Copy link

m12lrpv commented May 2, 2022

It almost looks like this bug was reintroduced...
#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.

@MPeli
Copy link

MPeli commented May 31, 2022

I am facing the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants