Javi
Javi

Reputation: 19799

Jeditable - Show Original Value After Submit

When I use jeditable in a table cell after the cell value is edited the value of the cell is changed with the value coming from the server:

I mean is the cell is

<td>old Value<td>

and I edit it and the server returns "new Value" jeditable inserts this value in the cell

<td>new Value<td>

Is there any way to avoid that the new value is inserted in the cell? I have tried with callback but with no success:

callback : function(value, settings) {
     return "false";
}

Thanks

Upvotes: 2

Views: 3679

Answers (2)

Kamil Sindi
Kamil Sindi

Reputation: 22862

Send back the old value from your PHP page in JSON form as {old_value : $_POST['value']}. and then in the callback do:

callback : function(data) {
     $(this).text(data.old_value);
}

Upvotes: 3

Amjad Masad
Amjad Masad

Reputation: 4035

The callback function is called after the value has been placed in the cell so returning false (without quotes) wont do it!
       So in your callback function change the value of the cell back.

callback : function(value, settings) {
     $(this).text(old_value);
}

Upvotes: 1

Related Questions