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

Cannot add property 0, object is not extensible, when selecting new items in multiple groupby mode #613

Open
reinoboonstra opened this issue Mar 30, 2022 · 0 comments

Comments

@reinoboonstra
Copy link
Contributor

reinoboonstra commented Mar 30, 2022

Getting this js error 'Cannot add property 0, object is not extensible' when selecting an item in my list.
Context:
This is my HTML: <angular2-multiselect [data]="countriesRegionsData" formControlName="countriesRegions" [settings]="settings">

These are my settings:
public settings = {
singleSelection: false,
text: 'Select Fields',
selectAllText: 'Select All',
unSelectAllText: 'UnSelect All',
searchPlaceholderText: 'Search Fields',
enableSearchFilter: true,
badgeShowLimit: 5,
primaryKey: 'countryCode',
labelKey: 'countryName',
groupBy: 'regionName'
};
This is the object I use:
export interface ICountryRegion {
regionId: string;
regionName: string;
countryCode: string;
countryName: string;
}
I use version 5.0.4
It goes wrong on line 1649 of angular2-multiselect-dropdown.js: this.selectedItems.push(item);
This could probably be replaced by [...this.selectedItems, item]; i.e. making a new copy of the array.

reinoboonstra added a commit to reinoboonstra/angular2-multiselect-dropdown that referenced this issue Apr 1, 2022
Solution: Cloning the array together with the new value.
CuppaLabs added a commit that referenced this issue Nov 13, 2023
#613 Fix: Cannot add property 0, object is not extensible
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

1 participant