Dropdown options issue

UI Components for Angular
Post Reply
MaheshKudikala
Posts: 1
Joined: 17 Jan 2022, 07:37

17 Jan 2022, 07:44

I have pdropdown inside the grid i binded dropdown options based on function but issue what i am having is options is being selected when i double click on option. Can anyone please suggest some suggestions.

.html code
-----------------------------------------------------------
<p-dropdown
placeholder="(select one)"
[options]="newUserTypeDetails(record)"
(onChange)="onUserTypeChange($event)"
[(ngModel)]="record.newUserType"
>
</p-dropdown>

.ts code
-------------------------------------------------------------------------------
newUserTypeDetails(record: UserDetailsForSummaryDemographics) {
let options = []
switch (record.userType.toLowerCase()) {
case 'r':
options = this.usertypes.filter(x =>
x.code == 'FE' || x.code == 'A' || x.code == 'CR' || x.code == 'NS' || x.code == 'OT'
).map(o => ({ 'value': o.code, 'label': o.name }));
break;
case 'fe':
options = this.usertypes.filter(x =>
x.code == 'A' || x.code == 'OT'
).map(o => ({ 'value': o.code, 'label': o.name }));
break;
case 'ms':
options = this.usertypes.filter(x =>
x.code == 'R' || x.code == 'NS' || x.code == 'OT'
).map(o => ({ 'value': o.code, 'label': o.name }));
break;
case 'cr':
options = this.usertypes.filter(x =>
x.code == 'FE' || x.code == 'NS' || x.code == 'A'
).map(o => ({ 'value': o.code, 'label': o.name }));
break;
default:
break;

}
options.unshift({ 'value': 'AR', 'label': 'Archive User' });
return options;
}

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: Ritik2411 and 15 guests