Dear Allan,
I am having a problem with jquery dataTable plugin. I am using two text box and a button and onclick event of that button i am calling my dataTable.
After Page load..FIRST time when i clicked on button , dataTables working fine and populates records and performs all its functionality..
but when i change some values in text box and again click on button SECOND time to populate dataTables with new records...Its give me error like "Cannot reinitialize dataTables"...Then to resolve these error i used "fnClearTable" and "fnDestroy" function of dataTables (as i used it in my following code)...But still i am not able to reinitialize dataTable and GETTING OLD VALUES NOT FRESH ONE...
Below is my javascript code to call dataTables and trying to reinitialize it.... please help me to solve these problem...i am waiting for ur reply..
thanks in advance..
I am having a problem with jquery dataTable plugin. I am using two text box and a button and onclick event of that button i am calling my dataTable.
After Page load..FIRST time when i clicked on button , dataTables working fine and populates records and performs all its functionality..
but when i change some values in text box and again click on button SECOND time to populate dataTables with new records...Its give me error like "Cannot reinitialize dataTables"...Then to resolve these error i used "fnClearTable" and "fnDestroy" function of dataTables (as i used it in my following code)...But still i am not able to reinitialize dataTable and GETTING OLD VALUES NOT FRESH ONE...
Below is my javascript code to call dataTables and trying to reinitialize it.... please help me to solve these problem...i am waiting for ur reply..
thanks in advance..
$('#id_prepack').click(function() { //alert("clicked"); var button_id=$(this).attr('id'); alert(button_id); var str_mtr_from=document.getElementById("id_mtr_from").value; var str_mtr_to=document.getElementById("id_mtr_to").value; var str_cca_from=document.getElementById("id_cca_from").value; var str_cca_to=document.getElementById("id_cca_to").value; if((str_mtr_from!="" && str_mtr_to!="") || (str_cca_from!="" && str_cca_to!="")) { var settings={ "bDestroy":true, "bRetrieve": false, "bJQueryUI": true, "bServerSide": true, "bAutoWidth": true, "sAjaxSource": "/web_trial_one/SourceMeter?button_name="+button_id+"&txt_mtr_from="+str_mtr_from+"&txt_mtr_to="+str_mtr_to, "bProcessing": true, "sPaginationType": "full_numbers", "sDom": 'T<"clear">lfrtip', "oTableTools": { "aButtons": [ "copy","csv","xls","pdf", { "sExtends": "download", "sButtonText": "Download Excel", "sUrl": "/web_trial_one/prepack_download" } ], "sSwfPath": "./table_tool2.0/media/swf/copy_cvs_xls_pdf.swf" } }; if(typeof oTable=='undefined') { oTable = $("#prepack").dataTable(settings); } else { oTable.fnClearTable(); oTable.fnDestroy(); oTable=$("#prepack").dataTable(); oTable=$("#prepack").dataTable(settings); } } else { alert("To Proceed..Please Enter any Search Dimension Field"); } });