reinitialize tables solved

reinitialize tables solved

devyptdevypt Posts: 1Questions: 0Answers: 0
edited March 2011 in General
hi all ,
I was searching about a solution for reinitialising the table with Ajax and i have found agood solution that may help any one search for it,
all the idea is to make table empty before any new implementation with datatables
the soltion is to make at a div with an id or a class then empty it before request ,then append the main table structre to it ,then make your request.
the code:
at html page
[code]

[/code]
at javascript
[code]
var tab4=$("#dataTable").val();
if(tab4=='')
{
$("#tabs-4").html("nametitleprice");
}
var oTable = $('#mytable').dataTable( {
"bProcessing": true,"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sAjaxSource": 'http://localhost/salary/employee/getData/',
"fnServerData": function (sSource,aoData,fnCallback){

$.ajax({
"dataType":'json',
"type":'POST',
"url":sSource,
"cache":false,
"data":aoData,
"success":function(json){fnCallback(json); }
});
},
} );
[/code]

with my best wishes.
This discussion has been closed.