如何禁用 primeng p-table 选择模式?

How to disable primeng p-table selectionmode?

我正在使用 angular primeng <p-table>(共享组件)并且我的 [selectionMode]multiselect。 现在我只能通过单击行来选中复选框,我希望能够通过单击复选框本身来选中复选框。

有没有办法为我的 data-table 禁用 multiselect selectionmode 以便我可以通过单击复选框本身而不是行来选中复选框?我无法从 p-table 中删除 selectionmode,因为它在多个地方被使用。

这是我的p-table,是共享组件

<p-table #table [value]="data" [columns]="columns" [scrollable]="true" scrollHeight="420px" [(selection)]="selections"
   [selectionMode]="multiselect ? 'multiple' : 'single'" (onRowSelect)="onSelect($event)"
   (onRowUnselect)="onUnselect($event)" [sortField]="sortField" (onSort)="onSort($event)" [paginator]="paged"
   [rows]="pageSize" [rowsPerPageOptions]="ROWCOUNT_OPTIONS" [currentPageReportTemplate]="PAGE_REPORT"
   [showCurrentPageReport]="showCurrentPageReport" (onLazyLoad)="onLazyLoad($event)" (onPage)="onPageChange($event)"
   [lazy]="lazy" [lazyLoadOnInit]="lazyLoadOnInit" [loading]="loading" [totalRecords]="totalRecords"
   paginatorDropdownAppendTo="body" compareSelectionBy="equals" [class]="isEmpty ? 'h-scrollable' : ''"
   [resizableColumns]="true" columnResizeMode="expand">

这是我的html用法:

<data-table #productTable [columns]="columns" [data]="data" [loading]="loading" [multiselect]="true" selectionmode = ""
   defaultSortField="necLec">
</data-table>

我修好了。我刚刚将选择模式从多个更改为 none。