How can I intercept a value before it gets updated with the inline editor?
How can I intercept a value before it gets updated with the inline editor?
rodrigoguerrasa
Posts: 3Questions: 2Answers: 0
The editor.on('preEdit',... and editor.on('preSubmit', ... only gets triggered AFTER the data is sent to the server when using the quick inline editing. Why is that? Using v1.5.6.
This discussion has been closed.
Answers
Try the current version in a test sample and see if the behavior is the same.
I am using the 1.6 extensively and never noticed any behavior like that, using the preSubmit for client side verification.
preEdit
happens immediately before the data returned from the server is written to the DataTable.edit
andpostEdit
are basically the same and happen after the data has been written to the table.The sequence of events is documented here.
I completely accept that the naming of
preEdit
is poor in this regard! It makes sense from DataTables' point of view, but perhaps not in the overall context.Allan
Ok, I understood the naming logic and the triggers. In this case believe I was using the wrong Event. So, which Event should I use in order to capture the data immediately BEFORE it gets sent to the server and immediately AFTER the user edited the field with in the inline editing? Example: The user edited a field called "DATE_INCLUSION" and the date happened to be older than Today's date. I would like to catch that date, check it against Today's date and IF it is, let's say 3 days older than Today's date, I would not send it to the server for processing. Instead, I would warn the user to change it and revert back to the old date.
and
These are two separate things. Use
preSubmit
for the first and attach an event listener (such askeyup
to the input element -field().input()
) for the second.Allan