On deleting the row pagination goes back to first page.How to stay on present page.

On deleting the row pagination goes back to first page.How to stay on present page.

shivakakiletishivakakileti Posts: 2Questions: 0Answers: 0

my code :

jQuery(document).ready(function($)
{
$("#table-1").dataTable({
"sPaginationType": "bootstrap",
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"bStateSave": true
});

$(".dataTables_wrapper select").select2({
    minimumResultsForSearch: -1
});

});

And for deleting the row i am using following code:

$(document).ready(function() {
var oTable = $('#table-1').dataTable();
<?php mysql_data_seek($projects,0); while ($res111=mysql_fetch_array($projects)){ ?>
$("#delete<?php echo $res111['id']; ?>").bind("click", function(event){
var target_row = $(this).closest("tr").get(0); // this line did the trick
var aPos = oTable.fnGetPosition(target_row);
oTable.fnDeleteRow(aPos);
oTable.fnDraw();
$.ajax({
type: "POST",
url: "delete.php",
data:"id="+<?php echo $res111['id']; ?>,
success: function(response){
}
});
});
<?php } ?>
});

This discussion has been closed.