primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Drop down list onChange not working

Open ghost opened this issue 9 years ago • 9 comments

Current behavior <p-dropdown [options]="mappingOptions" placeholder="Select Field" (onChange)="onFieldChange=($event)">

The onChange event is not been called.

Expected behavior onChange callback should be called.

  • Angular version: 2.0.X 2.4.10

  • PrimeNG version: 2.0.X 2.0.5

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] Chrome

  • Language: [all | TypeScript X.X | ES6/7 | ES5] Typescript

ghost avatar Mar 21 '17 19:03 ghost

Have the same issue: <p-dropdown [options]="dropdownAccounts" [(ngModel)]="selectedAccount" [style]="{'width':'150px'}" (onChange)="onAccountSelect"> </p-dropdown>

Angular: 2.4.6 PrimeNG: 2.0.4

Alex19ey avatar Mar 22 '17 09:03 Alex19ey

I solve the problem, instead of (onChange)="onAccountSelect" should be (onChange)="onAccountSelect($event.value)"

Alex19ey avatar Mar 27 '17 15:03 Alex19ey

works without $event

<p-dropdown [options]="languages" [(ngModel)]="value" (onChange)="onChange()" [autoWidth]="false"> </p-dropdown>

cyberrranger avatar Mar 28 '17 08:03 cyberrranger

My (onChange) event gets fired even if I select the same item once again. Technically, it is not a change from the previous selection so this shouldn't happen.

Can somebody verify this?

smitpsanghavi avatar May 11 '17 11:05 smitpsanghavi

Can somebody verify this?

yes, (onChange) is fired if I select the same item once again

my code <p-dropdown [options]="countries" [(ngModel)]="value" (onChange)="onChange()" [autoWidth]="false"> </p-dropdown> countries.push({label: 'Bitte wählen', value: null}); countries.push({label: 'Deutschland', value: 'DE'}); countries.push({label: 'Österreich', value: 'AT'});

cyberrranger avatar May 12 '17 07:05 cyberrranger

Thanks @cyberrranger In this case an issue needs to be raised for this. This behavior is actually not correct and needs to be corrected.

smitpsanghavi avatar May 12 '17 09:05 smitpsanghavi

Tracked at #2760

cagataycivici avatar Jun 20 '17 19:06 cagataycivici

Hello i was wondering if i wanted to fire the onChange event whiel selecting same item how could i do it?

clokworker avatar Oct 05 '17 16:10 clokworker

please add a condition and use the findIndex array method based on the index implement the conditional flow of selection code execution

satyanarayanaAmzur avatar Aug 30 '19 13:08 satyanarayanaAmzur