we have a table in our page, with a few rows and a custom toggle button at the end. the table is loaded via html in the page, not via json.
now, the togglebutton at
Here is a possible solution:
In addition to your code you should update the datatables data as following
var rowIndex = table.fnGetPosition( $(this).closest('tr')[0] );
var aData = table.fnGetData( rowIndex );
aData[2] = txt; //third column
Here the jsfiddle
And even better solution would be to use fnUpdate
to update the data and display in the same time
Here the jsfiddle
// update column following here...
var followingCell = $(this).parents('td').prev();
var txt = followingCell.text() == "1" ? "0" : "1";
var rowIndex = table.fnGetPosition( $(this).closest('tr')[0] );
table.fnUpdate( txt, rowIndex , 2);
Also instead of us
var followingCell = $(this).parents('td').prev();
var txt = followingCell.text() == "1" ? "0" : "1";
use
var aData = table.fnGetData( rowIndex );
aData[2] //use it to check if the value is 0 or 1