primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Impossible to trigger "onEdit" and "onEditComplete" events in dataTable cell if the cell has dropdown or calendar

Open Gwiny opened this issue 9 years ago • 5 comments

I'm submitting a ... (check one with "x")

[ x] bug report => Search github for a similar issue or PR before submitting

**Current behavior**
The simple text fields call the onEdit event when you change the value of the cell, and onEditComplete event when you press "Enter" button to quit the cell editing. However, if a cell consists of a dropdown component or a calendar component (and i suspect some others), none of this events ever trigger. 

**Expected behavior**
onEdit event triggers on cell value change, independently of the cell's editor. onComplete event triggers when you choose different cell or click outside of the datatable. Possibly, dropdown and calendar components get out of the editing mode on "Enter" button press.

**What is the motivation / use case for changing the behavior?**
Without these triggers it is harder to implement datatable editing logic. 

* **PrimeNG version:** 2.0.0-rc.1

Gwiny avatar Jan 24 '17 05:01 Gwiny

Additionaly, there's a problem with "Tab" navigation through datatable. It works fine on the default text fields, however, breaks on dropdown and calendar fields. You can see this bug here.

Gwiny avatar Jan 24 '17 07:01 Gwiny

Hi @Gwiny, same problem here but "solved" it using native events:

<p-column field="rowName" header="Name" editable="true" sortable="custom" (sortFunction)="sortType($event, 'rowName')" [style]="{'overflow':'visible'}">
	<template let-col let-row="rowData" pTemplate="editor">
		<p-dropdown (onChange)="onRowUpdate(row)" [(ngModel)]="row[col.field]" [options]="rowOptions" [autoWidth]="false" required="true"></p-dropdown>
	</template>
</p-column>

Hope it helps!

AlejandroPerezMartin avatar Mar 07 '17 10:03 AlejandroPerezMartin

@AlejandroPerezMartin although it's not obvious immediately from the event object that the binding takes place, I tried using your suggestion and it works. I have to assign the event data to the current object yet, but that's the best we get here, I guess. Thanks a lot!

akolybelnikov avatar Jun 14 '17 08:06 akolybelnikov

I'm glad it helped @akolybelnikov :smile:

AlejandroPerezMartin avatar Jun 14 '17 08:06 AlejandroPerezMartin

Yes, thanks @AlejandroPerezMartin . That's a keeper!

bjareczek avatar Aug 01 '17 16:08 bjareczek