Editable Ajax
Editable Ajax
I recently upgraded from Datatables 1.6.x to 1.7.6.
I used to be able to edit table cells just fine.
Now I notice that after editing, there is another ajax call and the whole table is being rebuilt. It used to just update the cell that was edited.
Here is a part of my code:
[code]
"sAjaxSource": "/js/datatables.php",
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push(
{"name":"table", "value":"updates"}
);
$.ajax({
"dataType": 'json',
"type": 'POST',
"url": sSource,
"data": aoData,
"success": fnCallback
});
},
"fnDrawCallback": function () {
//edit in place
$('#table tbody td:nth-child(3),#table tbody td:nth-child(4),#table tbody td:nth-child(5)').editable('/js/ajax.php', {
"callback": function( sValue, y ) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1] );
},
"submitdata": function ( value, settings ) {
var aPos = oTable.fnGetPosition( this );
var aData = oTable.fnGetData( aPos[0] );
return {
"column": aPos[1],
"id": aData[1],
"type": "updates"
};
},
indicator: ''
});
} //fnDrawCallback
[/code]
The ajax.php just returns the value that was entered.
How do I make it so that there is not another ajax request for the full table?
I used to be able to edit table cells just fine.
Now I notice that after editing, there is another ajax call and the whole table is being rebuilt. It used to just update the cell that was edited.
Here is a part of my code:
[code]
"sAjaxSource": "/js/datatables.php",
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push(
{"name":"table", "value":"updates"}
);
$.ajax({
"dataType": 'json',
"type": 'POST',
"url": sSource,
"data": aoData,
"success": fnCallback
});
},
"fnDrawCallback": function () {
//edit in place
$('#table tbody td:nth-child(3),#table tbody td:nth-child(4),#table tbody td:nth-child(5)').editable('/js/ajax.php', {
"callback": function( sValue, y ) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1] );
},
"submitdata": function ( value, settings ) {
var aPos = oTable.fnGetPosition( this );
var aData = oTable.fnGetData( aPos[0] );
return {
"column": aPos[1],
"id": aData[1],
"type": "updates"
};
},
indicator: ''
});
} //fnDrawCallback
[/code]
The ajax.php just returns the value that was entered.
How do I make it so that there is not another ajax request for the full table?
This discussion has been closed.
Replies
Allan
What I don't quite understand is that on other pages with the same setup (and without the fourth paramter), the problem did not occur.
I'll add the parameter to all the editable function calls now, just to make sure.