Hello I need to have multiple selection via click on checkbox and single selection after click on the row. Have you any idea how can I join this on the same table?
https://www.primefaces.org/primeng/showcase/#/table/selection
CodePudding user response:
You can use onRowSelect
to remove everything else from the selection but the clicked item.
Your p-table definition will be like:
<p-table selectionMode="multiple" [(selection)]="selectedItems" (onRowSelect)="onRowSelect($event) ...> ... </p-table>
and your function
onRowSelect(event) {
this.selectedItems = [event.data];
}
So that checkboxes use the default primeng behaviour, while row clicking deselects everything else.
CodePudding user response:
onRowSelect(event) { this.selectedItems = null; this.selectedItems = [event.data]; }
Something like this? This is not working. How can I deselects everything else?