Create a function if something is really edited
Create a function if something is really edited
Hello,
i'm just working on editor in order to create a function when a filed is really edited.
So i'm thinking about on initEdit event to retrieve the data field then call Edit event to launch the function.
Something like that:
editor.on('initEdit', function () {
oTable = $('#meetings').dataTable();
var sData1 = oTable.fnGetData(this.s.editRow);
Now how can i retrieve the current field value???
});
editor.on('onEdit', function () {
oTable = $('#meetings').dataTable();
var sData2 = oTable.fnGetData(this.s.editRow);
Now how can i retrieve the current field value???
// Something here to check if the value is changed???
jQuery.ajax({
type: 'POST',
url: "../pages/email.php", //Here i need to pass modified value..how???
dataType: "json",
success: function(data){ alert("Email sending status to : " + data.emailto_Part + " = " + data.emailSent); }
});
});
Could you help me to complete this code or better suggest me the best way to accomplidh this?
Thank you
This discussion has been closed.
Replies
Use
val()
to get (and set) the value of a field. So you might do something like:Allan
mm..good staring point...
and is there any smart method that can i use (inside .on( 'edit', function () {) to send to php function all rows value?
I mean:
right now in editor i want to show only one filed caller "status".
When when the edit has been made i would like to pass to php scripts all rows values.
What do you think about?
Thank you
The row values are passed in as the third parameter to
initEdit
events, so you could use that perhaps?Allan
mmm...could be..
Could you please post me an example in order to work on it? So i could verify if its what i need.
Thank you
Typo in my last comment for link - now fixed.
Allan
oh...good!!
Thank you very much..
That's what i was searching for...
Thank you again
And what about PostEdit events...seems that does not keep the same parameters:
editor.on( 'initEdit', function ( e, node, data ) {
console.log( data );
} );
Cause i would to pass data when are already updated
Am i right?
postEdit
provides three parameters - the event, the json from the server and the data used to set the row. That is documented in:postEdit
.Allan