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

Multiselect: selectionLimit not working if the value 0 is provided #15400

Closed
m3allimm4a4 opened this issue Apr 29, 2024 · 2 comments
Closed

Multiselect: selectionLimit not working if the value 0 is provided #15400

m3allimm4a4 opened this issue Apr 29, 2024 · 2 comments
Assignees
Labels
Resolution: Stale Issue or pull request is inactivity and unfortunately it will be *closed* if there is no response Type: Bug Issue contains a bug related to a specific component. Something about the component is not working

Comments

@m3allimm4a4
Copy link

Describe the bug

if the [selectionLimit] property is set to zero, it's treated the same as null or undefined (because javascript). Instead I am having to work around that by disabling all options if the selectionLimit is zero.
This error is caused by the following code snipet

maxSelectionLimitReached() {
        return this.selectionLimit && this.modelValue() && this.modelValue().length === this.selectionLimit;
}

null or undefined check should be done on this.selectionLimit

Environment

Angular 17, reactive forms

Reproducer

No response

Angular version

17

PrimeNG version

17.11

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18

Browser(s)

chrome. edge

Steps to reproduce the behavior

HTML:

<p-multiSelect
            formControlName="centrales"
            display="chip"
            appendTo="body"
            [options]="options.centrales"
            [showClear]="false"
            [style]="{ width: '100%' }"
            [virtualScroll]="true"
            [virtualScrollItemSize]="43"
            [selectionLimit]="maxSelectedConnectors">
</p-multiSelect>

TS:
when the value of maxSelectedConnectors is changed to 0, the feature doesn't work anymore as discribed previously

Expected behavior

the selectionLimit should be set to 0, which means all options should be disabled

@m3allimm4a4 m3allimm4a4 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 29, 2024
@mehmetcetin01140 mehmetcetin01140 added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jun 6, 2024
@mehmetcetin01140 mehmetcetin01140 added this to the 17.18.1 milestone Jun 6, 2024
@mehmetcetin01140 mehmetcetin01140 self-assigned this Jun 7, 2024
@cetincakiroglu cetincakiroglu modified the milestones: 17.18.1, 17.18.2 Jun 13, 2024
@mehmetcetin01140 mehmetcetin01140 removed this from the 17.18.2 milestone Jun 24, 2024
Copy link

This issue has been automatically marked as stale. If this issue is still affecting you with the latest version, please leave any comment, and we will keep it open. We are sorry that we have not been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@github-actions github-actions bot added the Resolution: Stale Issue or pull request is inactivity and unfortunately it will be *closed* if there is no response label Oct 23, 2024
Copy link

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you for your understanding!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Stale Issue or pull request is inactivity and unfortunately it will be *closed* if there is no response Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants