Impossible to trigger "onEdit" and "onEditComplete" events in dataTable cell if the cell has dropdown or calendar
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
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.
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 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!
I'm glad it helped @akolybelnikov :smile:
Yes, thanks @AlejandroPerezMartin . That's a keeper!