Table Never redraws using ajax
Table Never redraws using ajax
My problem is with jEditable and my remove row code that uses server side processing. Whenever I try and redraw the table it doesn't do anything yet I can always retrieve information from the table so I know i'm accessing it right.
I am able to edit the table using jEditable but when i'm done and the php successfully executes the query the table just says "Processing" in the header and Data Tables empties the cell instead of updating it. On a page refresh the table looks correct so the php and mysql works fine.
sEcho is never set, I always have to set it to 1 because it's empty in the $_GET, and I don't understand why fnDraw() won't redraw the table in the callback function...When I do a table redraw using a link it works fine. It's just after editing the table never refreshes...I have multiple tables if that makes any difference
Here's the innitialization:
[code]
//Set up the table(s) and store them in case we need quick access
$('table.display').each( function(){
//Global tables array
var current = $(this).dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "./generate.php",
"fnServerData": function ( sSource, aoData, fnCallback ) {
//Add additional information for server side script regarding which table we're working on
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": {"list":($(this).attr('id'))},
"success": fnCallback
} );
},
"bSort": true,
"bJQueryUI": true,
"bFilter": true,
"bStateSave": true,
"fnDrawCallback": function () {
$('table.display tbody td[class!="readonly"]').editable( './update.php', {
"placeholder" : "",
"callback": function( sValue, y ) {
/* Redraw the table from the new data on the server */
current.fnDraw();
},
"submitdata": function ( value, settings ) {
/*information for server side processing, column to update w/ GGID+Table as additional clarity*/
return{
"row_id": this.parentNode.getAttribute('id'),
"colID": $(this).parents('table:first').dataTable().fnGetPosition( this )[2]
};
},
"height": "14px"
});
}
});
tables.push(
current
);
});
[/code]
No idea what's wrong and why this won't work...any time I try and redraw the table using ajax it doesn't work, but I can always retrivieve information from the table using the same code and printing it instead of drawing the table...Any help would be great thanks.
I am able to edit the table using jEditable but when i'm done and the php successfully executes the query the table just says "Processing" in the header and Data Tables empties the cell instead of updating it. On a page refresh the table looks correct so the php and mysql works fine.
sEcho is never set, I always have to set it to 1 because it's empty in the $_GET, and I don't understand why fnDraw() won't redraw the table in the callback function...When I do a table redraw using a link it works fine. It's just after editing the table never refreshes...I have multiple tables if that makes any difference
Here's the innitialization:
[code]
//Set up the table(s) and store them in case we need quick access
$('table.display').each( function(){
//Global tables array
var current = $(this).dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "./generate.php",
"fnServerData": function ( sSource, aoData, fnCallback ) {
//Add additional information for server side script regarding which table we're working on
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": {"list":($(this).attr('id'))},
"success": fnCallback
} );
},
"bSort": true,
"bJQueryUI": true,
"bFilter": true,
"bStateSave": true,
"fnDrawCallback": function () {
$('table.display tbody td[class!="readonly"]').editable( './update.php', {
"placeholder" : "",
"callback": function( sValue, y ) {
/* Redraw the table from the new data on the server */
current.fnDraw();
},
"submitdata": function ( value, settings ) {
/*information for server side processing, column to update w/ GGID+Table as additional clarity*/
return{
"row_id": this.parentNode.getAttribute('id'),
"colID": $(this).parents('table:first').dataTable().fnGetPosition( this )[2]
};
},
"height": "14px"
});
}
});
tables.push(
current
);
});
[/code]
No idea what's wrong and why this won't work...any time I try and redraw the table using ajax it doesn't work, but I can always retrivieve information from the table using the same code and printing it instead of drawing the table...Any help would be great thanks.
This discussion has been closed.