Refresh table... Need Help please
Refresh table... Need Help please
Hi :)
I've a problem with the refresh of my table with datas from MySql.
I'm explaining.
I have 10 rows (page1), 5 rows (page2). When I remove a row in page 1, I have 9 rows (page1) and 5 rows (page2) and I lose my CSS. Normally, it would be: 10 rows (page1) and 4 rows (page2)
I hope you can help me ... Thanks a lot
This is my code:
[code]
$(function(){
$('#datatables').dataTable({
"sPaginationType":"full_numbers",
"aaSorting":[[0,"asc"]],
"bProcessing" : true,
"bDeferRender" : true,
"bDestroy" : true
});
$('.deleteBtn').live('click', function () {
var oTable=$('#datatables');
var id = $(this).attr("id");
var dataString = 'id='+ id;
$.ajax({
type: "POST",
url: "deleteData.php",
data: dataString,
//cache: false,
//async: false,
success: function(retour){
if(retour == 0){
$("#manageImage").hide();
$("#noList").show();
}else{
$(".bar"+id).animate({ opacity: "hide" }, "slow");
oTable.fnClearTable(0);
oTable.fnAddData(data);
oTable.fnDraw();
}
}
});
return false;
});
});
[/code]
I've a problem with the refresh of my table with datas from MySql.
I'm explaining.
I have 10 rows (page1), 5 rows (page2). When I remove a row in page 1, I have 9 rows (page1) and 5 rows (page2) and I lose my CSS. Normally, it would be: 10 rows (page1) and 4 rows (page2)
I hope you can help me ... Thanks a lot
This is my code:
[code]
$(function(){
$('#datatables').dataTable({
"sPaginationType":"full_numbers",
"aaSorting":[[0,"asc"]],
"bProcessing" : true,
"bDeferRender" : true,
"bDestroy" : true
});
$('.deleteBtn').live('click', function () {
var oTable=$('#datatables');
var id = $(this).attr("id");
var dataString = 'id='+ id;
$.ajax({
type: "POST",
url: "deleteData.php",
data: dataString,
//cache: false,
//async: false,
success: function(retour){
if(retour == 0){
$("#manageImage").hide();
$("#noList").show();
}else{
$(".bar"+id).animate({ opacity: "hide" }, "slow");
oTable.fnClearTable(0);
oTable.fnAddData(data);
oTable.fnDraw();
}
}
});
return false;
});
});
[/code]
This discussion has been closed.
Replies
Allan
The problem was that I didn't count rows.
No all is fine :)