Refresh table... Need Help please

Refresh table... Need Help please

mano7859mano7859 Posts: 2Questions: 0Answers: 0
edited May 2012 in General
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]

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Can you link to a page demonstrating the issue please? DataTables does work the way you describe that it should, so there is something else going on here.

    Allan
  • mano7859mano7859 Posts: 2Questions: 0Answers: 0
    Thanks Allan for your help I've used a part of your code : http://datatables.net/blog/Inline_editing

    The problem was that I didn't count rows.

    No all is fine :)
This discussion has been closed.