DataTables warnings (table id="datatable"); cannot reinitialise DataTable.
DataTables warnings (table id="datatable"); cannot reinitialise DataTable.
i have just started using datatables and was trying to embed it in my theme. i am using server side method and getting a response from ajax file from db. whenever i try to run it. i am getting reinitialise error. Any suggestion where i am wrong.
here's my main file:
$('#dataTable').DataTable({
'processing' : true,
'serverSide' : true,
'serverMethod' : 'post',
'ajax':{
'url':'ajaxfile.php'
},
'columns':[
{data:'ID'},
{data:'Student_Name'},
{data:'CNIC'},
{data:'Father_name'},
{data:'DOB'},
{data:'Gender'},
{data:'Qualification'},
{data:'Nationality'},
{data:'Religion'},
{data:'Province'},
{data:'Home_Address'},
{data:'P_mobileNo'},
{data:'P_email'},
{data:'Present_Posting'},
{data:'Designation'},
{data:'Grade'},
{data:'basic_pay'},
{data:'Official_PostalAddress'},
{data:'Office_PhoneNo'},
{data:'Office_Fax'},
{data:'Date_InAppointment'},
{data:'Date_inPGrade'},
{data:'E_ContactName'},
{data:'E_TelephoneNo'},
{data:'PresentEmp_Company'},
{data:'DDO_name'},
{data:'DDO_Address'},
{data:'Imme_Supervisor'},
{data:'Supervisor_Designation'},
{data:'ProfilePicture'},`````> ```````
{data:'CNIC_front'},
{data:'CNIC_back'},
{data:'Role'},
{data:'Is_Id_Allocated'}
]
});
Ajaxfile.php :
$data[] = array
(
echo "hello";
"ID" => $row['ID'],
"Student_Name" => $row['Student_Name'],
"CNIC" => $row['CNIC'],
"Father_name" => $row['Father_name'],
"DOB" => $row['DOB'],
"Gender" => $row['Gender'],
"Qualification" => $row['Qualification'],
"Nationality" => $row['Nationality'],
"Religion" => $row['Religion'],
"Province" => $row['Province'],
"Home_Address" => $row['Home_Address'],
"P_mobileNo" => $row['P_mobileNo'],
"P_email" => $row['P_email'],
"Present_Posting" => $row['Present_Posting'],
"Designation" => $row['Designation'],
"Grade" => $row['Grade'],
"basic_pay" => $row['basic_pay'],
"Official_PostalAddress" => $row['Official_PostalAddress'],
"Office_PhoneNo" => $row['Office_PhoneNo'],
"Office_Fax" => $row['Office_Fax'],
"Date_InAppointment" => $row['Date_InAppointment'],
"Date_inPGrade" => $row['Date_inPGrade'],
"E_ContactName" => $row['E_ContactName'],
"E_TelephoneNo" => $row['E_TelephoneNo'],
"PresentEmp_Company" => $row['PresentEmp_Company'],
"DDO_name" => $row['DDO_name'],
"DDO_Address" => $row['DDO_Address'],
"Imme_Supervisor" => $row['Imme_Supervisor'],
"Supervisor_Designation" => $row['Supervisor_Designation'],
"ProfilePicture" => $row['ProfilePicture'],
"CNIC_front" => $row['CNIC_front'],
"CNIC_back" => $row['CNIC_back'],
"Role" => $row['Role'],
"Is_Id_Allocated" =>$Is_Id_Allocated,
);
Answers
There are so many posts on this in this forum ... Just check them out.
Here is one of them with more links to other posts:
https://datatables.net/forums/discussion/comment/171227/#Comment_171227