Refresh the table after deleting row

Refresh the table after deleting row

mohaideenmohaideen Posts: 10Questions: 3Answers: 0
edited April 2014 in DataTables 1.8
I have using data from server side to the DataTable. When i click the some action in table, that row want to be delete. Then Referesh the table.

When i clik the action in table, row will be deleted. This is by server side processing. and


Here one issue is there.

if i use "bServerSide" , Search box doesn't work.

If i not use "bServerSide", that row was deleted, but remianing rows are hide. When i click on TH, then remaining rows are shown. What is the issue there.. I cant find the solution.

[code]
function DataTableFun() {

DataTable = $('#DataTable').dataTable({
"sAjaxSource": "php/pendingApprovals.php",
"bRetrieve":true,
"bDestroy":true,
"fnInitComplete": function (oSettings, json) {
$('#loader').hide();
},

"aoColumns": [{
"mData": "name",
}, {
"mData": "managerName",
}, {
"mData": "createdTime"
}, {
"mData": "hasAdminReg",
"sTitle": "Admin Registration",
"mRender": function ( data, type, row ) {
if(row.hasAdminReg==0)
{
return "Yes";
}
else
{
return "No";
}
},
}, {
"mData":"imei",
"mRender": function(data, type, row)
{
return ''+row.imei+'';
}
},{
"mData": "imei",
"mRender": function ( data, type, row ) {
return ''
},
}],
});
[/code]

after deleting the row. i used this

[code]
DataTable._fnAjaxUpdate();
DataTable.fnDraw();
//DataTable.fnReloadAjax();
DataTableFun();
[/code]

Replies

  • allanallan Posts: 52,268Questions: 1Answers: 7,958 Site admin
    [quote]
    "bRetrieve":true,
    "bDestroy":true,
    [/quote]

    Why are you trying to both destroy and retrieve the table? The two are mutually incompatible. I'm not even sure which one will occur without looking at the code...

    If you want to refresh the data from the server, simply call `DataTable.fnReloadAjax();` . Do not try to decrease the table (i.e. don't call your `DataTableFun()` function, don't use the internal functions, just fnReloadAjax .

    And if that doesn't work, please link to a test case showing the issue.

    Allan
This discussion has been closed.