Georgi Georgiev
Georgi Georgiev

Reputation: 21

primeNg multiselect should not disable options if selection limit is reached

I'm using primeNg multiselect in Angular Project

If I have a dropdown of items and I set selection limit to 1, all items get disabled if the user selects an item of the dropdown.
But if the user wants to select another item, they need to deselect the already selected item first in order to be able to select another item.

Is there a way to prevent disabling the options when the selecting limit is reached so if the user selects and item, they could change the selected item with simple click, not needing to deselect the already selected item first.

Tried Primeng doco, no answer found.

Code to reproduce with one possible selection :

<p-multiselect [options]="cities" [(ngModel)]="selectedCities" optionLabel="name" placeholder="Select Cities" [maxSelectedLabels]="3" styleClass="w-full md:w-80" [selectionLimit]=1/>

and in the ts file

cities = {name: 'New York', code: 'NY'},
            {name: 'Rome', code: 'RM'},
            {name: 'London', code: 'LDN'},
            {name: 'Istanbul', code: 'IST'},
            {name: 'Paris', code: 'PRS'}

Upvotes: 1

Views: 16

Answers (0)

Related Questions