Server side delete row
Server side delete row
Hi everyone, I'm using the datatable for a CMS and I'm having troubles when deleting a record, I first make the call to the ajax and delete the actual record, once is deleted I use fnDeleteRow to delete the record from the table, the problem I'm having is that after I remove the record from the table with fnDeleteRow, the table reloads the record and then go back to the first page, what I want to accomplish is after the record is deleted, if it's possible (if there are more records on that page) stay on the same page. I hope I was clear, Here is the code I'm using
[code]
$(document).ready(function() {
var aoColumns = [];
$('#example thead th').each( function () {
if ( $(this).hasClass( 'no_sort' ) ){
aoColumns.push( { "bSortable": false } );
} else {
aoColumns.push( null );
}
} );
// assign a function for the click event to the delete btn
$("#example tbody a.delete_row").live('click', function(){
deleteFunc (this,userTable, "user_delete")
});
// initialize the dataTable
var userTable = $('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "indexAjax.php?cp=user_ajax&ajax=1",
"sPaginationType": "full_numbers",
"iDisplayLength": 1,
"bSortClasses": false,
"aoColumns": aoColumns
} );
} );
function fnGetSelected( oTableLocal )
{
var aReturn = new Array();
var aTrs = oTableLocal.fnGetNodes();
for ( var i=0 ; i
[code]
$(document).ready(function() {
var aoColumns = [];
$('#example thead th').each( function () {
if ( $(this).hasClass( 'no_sort' ) ){
aoColumns.push( { "bSortable": false } );
} else {
aoColumns.push( null );
}
} );
// assign a function for the click event to the delete btn
$("#example tbody a.delete_row").live('click', function(){
deleteFunc (this,userTable, "user_delete")
});
// initialize the dataTable
var userTable = $('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "indexAjax.php?cp=user_ajax&ajax=1",
"sPaginationType": "full_numbers",
"iDisplayLength": 1,
"bSortClasses": false,
"aoColumns": aoColumns
} );
} );
function fnGetSelected( oTableLocal )
{
var aReturn = new Array();
var aTrs = oTableLocal.fnGetNodes();
for ( var i=0 ; i
This discussion has been closed.
Replies
Thanks