PrimeNG - DataTable with individual column selection

2k views Asked by At

I want a datatable with the feature inside the column, with the option to select between two values which is been displayed.

like in the below code

<p-dataTable [value]="assocArray" [paginator]="true" [rows]="10" [globalFilter]="gb" selectionMode="single" [(selection)]="selectedAssociate" 
                        (onRowSelect)="onAssociateRowSelect($event)">
                     <p-column field="assocTypename" header="Associate Format" [sortable]="true">
                        <template let-col="rowData" pTemplate type="body">
                            <span>{{col.assocTypeName}}</span>
                        </template>
                    </p-column>
                    <p-column field="addressee" header="Addressee" [sortable]="true">
                        <template let-col="rowData" pTemplate type="body">
                            <span>{{col.addressee}}</span>
                        </template>
                    </p-column>
                    <p-column field="contactname" header="Contact Name" [sortable]="true">
                        <template let-col="rowData" pTemplate type="body">
                            <span>{{col.contactname}}</span>
                        </template>
                    </p-column>
                     <p-column field="heading" header="Current Heading" [sortable]="true" selectionMode="multiple">
                        <template let-col="rowData" pTemplate type="body">
                            <span>{{col.heading}}</span>
                        </template>
                    </p-column>
                    <p-column field="heading" header="System Generated Heading" [sortable]="true" selectionMode="multiple">
                        <template let-col="rowData" pTemplate type="body">
                            <span>{{col.heading}}</span>
                        </template>
                    </p-column>
                    </p-dataTable>

I want to be able to select the values from either of the two columns Current Heading and System generated heading for that particular row. Could you please let me know if you have an option like that and how to accomplish this?

Tried the column selection mode property but it wouldn't get the actual value for that particular column.

0

There are 0 answers