CuppaLabs / angular2-multiselect-dropdown

Angular 2 Dropdown Multiselect
https://cuppalabs.github.io/angular2-multiselect-dropdown
MIT License
280 stars 257 forks source link

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

Open reinoboonstra opened 2 years ago

reinoboonstra commented 2 years ago

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.