OhioPrimeNGDev
OhioPrimeNGDev

Reputation: 71

primeNG: 13.4.0 p-dropdown set default value

I am creating a webpage with PrimeNG: 13.4.0 and Angular: 13.3.6. I have a dropdown in a p-table grid that should display a Country Of Origin. When I open the row for edit, the p-dropdown does not display the importLine.countryOfOrigin value. This is my html:

    <p-cellEditor>
              <ng-template pTemplate="input" style="width: 30rem">
                <p-dropdown appendTo="body" 
    [(ngModel)]="importLine.countryOfOrigin" name="countryOfOrigin" 
    value="countryOfOrigin" [options]="countriesOfOriginGSACompliant" 
    optionLabel="name" [filter]="true" filterBy="value" 
   (onChange)="saveSelectedCountry($event.value, 
   importLine.supplierSku)">
       </p-dropdown>
        </ng-template>
        <ng-template pTemplate="output">
            {{ importLine.countryOfOrigin }}
             </ng-template>
       </p-cellEditor>

Upvotes: 2

Views: 885

Answers (1)

Ihor
Ihor

Reputation: 726

I had the same issue, and could not find any real solution for that. So, as a result, I roll back to PrimeNG 13.3.3. In that version, default value works as expected. You can do that via npm npm i [email protected]

If anyone finds out why it does not work in 13.4.0, please let us know :)

Upvotes: 1

Related Questions