Error on calling datatable.ajax - typeError, x.ajax is undefined
Error on calling datatable.ajax - typeError, x.ajax is undefined
dorduk
Posts: 2Questions: 1Answers: 0
I'm guessing I've got some setting (or is it all of them??) that is making the whole thing revert to the 1.9 structure?
Simple example works:
<script>
var table;
$(function() {
table = $('#Appointments').DataTable( {
ajax: "loadGridAjax.asp?a=b"
});
});
setInterval( function () {
console.log(table);
table.ajax.reload();
console.log("loading");
}, 3000 );
</script>
Fails:
<script>
var test;
//$(function() {
test= $('#Appointments').dataTable( {
"oLanguage": { "sSearch": "Search within results:",
"sProcessing": "Loading Data...<img src='/shared/img/images/loader.gif' /><br />" },
"aaSorting": [],"bProcessing": true,"iDisplayLength": 25,
ajax: "loadGridAjax.asp?a=b",
"bDeferRender": true,
"fnInitComplete": function(oSettings) { if(this.fnSettings().fnRecordsTotal() > 0) {jQuery('#Appointments_section').show();} if(this.fnSettings().fnRecordsTotal() < 25) { jQuery('#Appointments_wrapper .top').hide(); jQuery('#Appointments_wrapper .footer').hide(); }},
"fnCreatedRow": function(nRow, aData, iDataIndex) {TiGrAppointments.addJavascript(nRow, iDataIndex+1, 0,-2,15);
jQuery(nRow).children("td").bind('contextmenu', {name: 'TiGrAppointments'}, function(e) {TiGrAppointmentstcmenu.HandleClick(e); return false;});},"sDom": '<"top"fl>tr<"footer"ip>',
"sPaginationType": "full_numbers",
"bDestroy": true,
"bFilter": true,
"aoColumnDefs": [
{ "bVisible": false, "aTargets": [ 0,3,6,11,14,15 ] }
,{ "sWidth": "60px", "aTargets": [ 1 ] }
,{ "bSortable": false, "aTargets": [ 1 ] }
]
});
//});
window.setTimeout(function() {
console.log("calling");
console.log(fish);
test.ajax.reload(); // here - error that ajax is undefined
console.log("did anything happen?");
}
, 5000);
</script>
This discussion has been closed.
Answers
Oh, ok, I found the upgrade FAQ - DataTable() not dataTable().