Simple Inline editing detect value and do action
Simple Inline editing detect value and do action
Hi there!
i have already implemented simple inline editor like that:
$('#example').on( 'click', 'tbody td:not(.child), tbody span.dtr-data', function (e) {
// Ignore the Responsive control and checkbox columns
if ( $(this).hasClass('select-checkbox') ) {
return;
}
editor.inline( this );
} ),
What i need is:
-Detect when the cell 'data.incomes.status' is updated with the value "Validated", make an ajax call to update other database value.
How can i check if the cell 'data.incomes.status' is updated using the inline editor? with only that i can do the rest. Is there a "updated function" to call or something like that?
thanks for the help
This question has an accepted answers - jump to answer
Answers
postEdit
sounds like what you want. That will be triggered when a row's data is updated via Editor.Allan
@allan Do you have any example of use?
i have this:
editor.on('submitSuccess', function(e, json, data)
{ ....
Should i use?:
editor.on('postEdit', function(e, json, data)
{ ....
other question, why when i update, it fired 2 times the ajax call? it's like it is recharging data 2 times, or making 2 times the submit. this is the code.
editor.on('postEdit', function(e, json, data)
{
var modifier = editor.modifier();
var currentRow = table.row(modifier).node();
Looks right to me
I'd need a link to a test case showing the issue to understand why that is happening. Perhaps you have server-side processing enabled?
Allan
@allan Solved, problem was i was firing the " editor.on('postEdit', function(e, json, data) " inside the "$('#example').on( 'click', 'tbody td:not(.child), tbody span.dtr-data', function (e) {" so any time i click for edit, it fires the function.
One more last question.
in the function "editor.on('postEdit', function(e, json, data)" is it possible to know who is the value that make the postEdit?
For example. I have a table with values: Name, Surname, Mobile, Money.
i want to know if the postedit happens on the Name, or Mobile, to create a condition for example:
if postEdit happens, if happens on data.Money, if data.money > 100 then...
So is it possible to know wich data is making the postedit?
THANKS!!!!
Which value being edited is triggering the
postEdit
event? Yes, the original data will be in thedata
object, and if you have it submitting only the changed values, then only the changed values will be in that object.Allan
@allan thanks Allan, you're awesome! it's working perfectly.