I have one partial view, onload which is loading in table tbody perfectly. But after that in the same page onchange dropdown when i m calling the same partial view it is binding but it is showing this error. I am using bootstrap DataTable.
DataTables warning: table id=DataTables_Table_0 - Cannot reinitialise DataTable.
For more information about this error, please see http://datatables.net/tn/3
Here what i have done. This is the onload function.
$(document).ready(function () {
var collectoinPointUrl = ROOT + "Dietitian/PatientDietList_Pv"
$.ajax({
url: collectoinPointUrl,
data: { WardId: 0 },
type: "GET",
success: function (result) {
$('#LoadPatientList').html(result);
}
});
});
And this is onchange function
$('#SearchPatient').click(function () {
var WardId = $('#Wardid option:selected').val();
var collectoinPointUrl = ROOT + "Dietitian/PatientDietList_Pv"
$.ajax({
url: collectoinPointUrl,
data: { WardId: WardId },
type: "GET",
success: function (result) {
//if (!$.fn.DataTable.isDataTable('#patientdiettable')) {
//$('.dataTable-length').DataTable({
// destroy: true,
//}).clear().draw();
//}
$('#LoadPatientList').html(result);
}
});
});
I tried to destroy DataTable and bind again .still no luck. Any help will be appreciated. Thanks in Advance.