0
我有一個p-dataTable
嵌套p-dropdown
組件。在選擇一行時,如何獲得行的選定值?在選擇回調中,我收到支持每個下拉列表的數組,而不是選擇本身。PrimeNg - 使用嵌套組件的數據表選擇值
<p-dataTable [value]="affiliates" sortField="name" dataKey="id" selectionMode="single" (onRowSelect)="onRowSelect($event)" [rows]="15" [paginator]="true" [pageLinks]="10">
<p-column field="name" header="Name" sortable="true" [filter]="true" filterPlaceholder="Search" filterMatchMode="contains"></p-column>
<p-column field="package" header="Packages">
<ng-template let-affiliate="rowData" pTemplate type="body">
<p-dropdown [options]="affiliate.packages" dataKey="label"></p-dropdown>
</ng-template>
</p-column>
<p-column field="country" header="Countries">
<ng-template let-affiliate="rowData" pTemplate type="body">
<p-dropdown [options]="affiliate.countries" dataKey="label"></p-dropdown>
</ng-template>
</p-column>
<p-column field="device" header="Devices">
<ng-template let-affiliate="rowData" pTemplate type="body">
<p-dropdown [options]="affiliate.devices" dataKey="label"></p-dropdown>
</ng-template>
</p-column>
<p-column header="Actions">
</p-column>
</p-dataTable>