primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Allow Cancellation of DataTable OnEditComplete Event

Open jamesdking opened this issue 9 years ago • 9 comments

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

[ ] bug report => Search github for a similar issue or PR before submitting
[ X] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior It is not possible to cancel / stop the propagation of the Datatable OnEditComplete event.

Expected behavior Ability to cancel / stop propagation of the OnEditComplete event

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior? Allow validation of inline edits in a data table, and in the case of invalid data, disallow the completion of the edit.

Please tell us about your environment: N/A

  • Angular version: 4.0.X
  • PrimeNG version: 4.0.X
  • Browser: [all]
  • Language: [all]
  • Node (for AoT issues): node --version = N/A

jamesdking avatar May 30 '17 10:05 jamesdking

Sounds good but no idea how can we do it.

cagataycivici avatar May 31 '17 07:05 cagataycivici

Would including the original native event in the PrimeNG event work? So then stopPropagation() or preventDefault() could then be called on the native event.

jamesdking avatar May 31 '17 08:05 jamesdking

They are browser events, by the time they are called, ngModel has already written to the model. What we can try is writing to a dummy model and at browser events like blur, enter or else decide to write to actual model or not.

cagataycivici avatar May 31 '17 08:05 cagataycivici

Originally I was only thinking of preventing the browser event, for example, so that the focus could be forced to remain on a field where invalid data had been entered. I'd not considered whether the ngModel binding needed to be prevented, but being able to prevent the ngModel write sounds good.

jamesdking avatar May 31 '17 08:05 jamesdking

I don't think it is necessary to prevent writing to the model. If focus remains on the element that has the "issue", the user will be forced to fix it, or cancel it by hitting ESC key.

bjareczek avatar Jul 29 '17 12:07 bjareczek

I can say this: as much as I want to use this library, I'm about to move on to another library. This is very fundamental to grid behaviour (ability to validate and keep focus if no pass). Wish I could jump in and help! I think exposing native preventDefault() is just right.

bjareczek avatar Jul 29 '17 12:07 bjareczek

This would be great!

ibarton-c7ks7s avatar Aug 21 '17 20:08 ibarton-c7ks7s

It really needs something, because as far as I can tell, there's no way to validate anything entered using an editable DataTable.

brian428 avatar Aug 29 '17 03:08 brian428

p-dataTable is deprecated and will be removed in favor of the new p-table (aka TurboTable) of 5.1.0 so closing the issue. Please try the new p-table once 5.1.0 is released.

cagataycivici avatar Jan 13 '18 22:01 cagataycivici