primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Editing on datatable cell doesn't work with selectionmode

Open vvvttt opened this issue 10 years ago • 3 comments

Hello,

I am playing around with the primeng datatable. When I enable both the "SelectionMode” and “editable” properties to true on datatable, editing on cell doesn’t work, only selection does. As soon as I remove the selectionmode property, editing works. Either row selection or editing cells would work at a time. How can we get both working together?

Thanks.

vvvttt avatar Oct 03 '16 18:10 vvvttt

found a workaround for this

just use rowClick & remove selectionMode

then your function that reacts on event

onRowClick(e:any) {
this.selection = e.data;
]

on your datatable:

<p-dataTable (rowClick)="onRowClick($event)" 
editable="true" [(selection)]="selection">
</p-dataTable>

this way you still have selection functionality + editable functionality

Goldflow avatar Oct 05 '16 10:10 Goldflow

@Goldflow, Thanks for your response. For now I am using checkbox to do row selection. This way selection and editing work together.

vvvttt avatar Oct 05 '16 16:10 vvvttt

The event is now called onRowClick (PrimeNg 4.0.3), but workaround still working.

<p-dataTable (onRowClick)="onRowClick($event)" 
editable="true" [(selection)]="selection">
</p-dataTable>

mniederkofler avatar Jun 07 '17 13:06 mniederkofler