primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Datatable: editable property not working with selection prperty

Open vishal3007 opened this issue 10 years ago • 11 comments

If selectionMode is on for datatable, editable is not working.

Please see the below code snippet.

<p-dataTable [value]="roles" [headerRows]="headerRows"
    selectionMode="single" [(selection)]="selectedRole" (onRowSelect)="onRoleSelected()"
    (onRowUnselect)="onRoleUnSelected()" [editable]="true">
    <p-column field="name" [editable]="true"></p-column>
    <p-column field="description" [editable]="true"></p-column>
</p-dataTable>

vishal3007 avatar Oct 05 '16 10:10 vishal3007

The way I got it worked is by adding an extra column (check box) and setting selectionMode property on it rather than on the dtatable.

<p-column [style]="{'width':'38px'}" selectionMode="multiple">

vvvttt avatar Oct 05 '16 22:10 vvvttt

thanks vvvttt...I am trying to do the same thing but I only want to edit the selected row. How did you restrict the user to edit the column of non selected row?

vishal3007 avatar Oct 11 '16 20:10 vishal3007

Hey vishal3007,

I haven't implemented this feature since I am not restricting users from editing non selected rows.

Thanks.

vvvttt avatar Oct 11 '16 22:10 vvvttt

I do have the same issue, Editable is not working, when Selection Mode is Single, As you can edit any Cell, Selection mode single may not required. Hope that is per design.

GopiAnnan avatar Mar 06 '17 18:03 GopiAnnan

Same issue for me as well. I want to allow user to select multiple rows to delete in an editable table.

hiteshanchan avatar Mar 13 '17 22:03 hiteshanchan

This combination is not supported, better use a radio-checkbox because both bind to click event causing the conflict. Selection with a separate column like radio-checkbox-button will be the better solution. Even if we support it, I see a UX issue down the road.

cagataycivici avatar Jun 06 '17 13:06 cagataycivici

Even though this seems like a rare usecase, we have also run into this problem:

In our application we want to highlight the currently selected row (single select), to emphasize which row the user is currently working on. The application will also display additional information of the selected row in the footer (detail section). At the same time the application should allow to edit certain fields.

I would like to ask for your reasons to close this as an unsupported usecase, when the workaround described in https://github.com/primefaces/primeng/issues/1011 works and looks reasonably well: image

For us this workaround would be sufficient for our usecase to have editable=true and selectionMode=single at the same time.

Please reconsider your decision, if you have some time. Other than that, keep up the great work. :-)

mniederkofler avatar Jun 07 '17 13:06 mniederkofler

@mniederkofler I do absolutely agree. For us it's even a very common usecase having the row selected which is currently being edited. Especially when working in master detail scenarios.

I have seen this in a lot of applications and think it's much better UX than clicking a checkbox or radio somewhere in the datatable.

Would be great to have this feature. Thanks for your great work!

fxmfr avatar Jun 30 '17 08:06 fxmfr

I vote for this.

SpiderPork avatar Jul 25 '17 12:07 SpiderPork

My vote as well

mmlitvin avatar Oct 05 '17 18:10 mmlitvin

I vote for it

viswa-optimusprime avatar Nov 14 '17 20:11 viswa-optimusprime