Datatables - 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode.
Datatables - 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode.
Hi there, I'm currently designing a program in MVC5 ASP.Net and utilising data tables to display the data and trying to get it to use server side processing. Currently It seems to work on first load but callback then throws the exception: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them. Any ideas on how to fix this? I need it to get the data from the html table again due to MVC loading data into the table that way after the callback, I'm new to data tables so any help would be appreciated.
var table = $('#Example').DataTable();
$(document).ready(function () {
$('#Example').DataTable({
"cell-border": true,
"paging": true,
"processing": false,
"deferLoading": true,
"deferRender": true,
"scrollCollapse": true,
"DisplayLength": 10,
"cell-border": true,
"serverSide": true,
"ordering": false,
"searching": false,
"recordsTotal": 130000,
"recordsFiltered": 130000,
"ajax": function (data, callback, settings) {
debugger;
var out = table;
for (tableData in table) {
out.push();
}
debugger;
setTimeout(function () {
debugger;
callback({
"draw": out.draw(),
"data": out,
"recordsTotal": 130000,
"recordsFiltered": 130000
});
}, 50);
},
"scrollY": 200,
"scroller": {
"loadingIndicator": true
},
});
});
Answers
Can you give me a link to a page showing the error please?
Allan
"use strict" is a new feature of ECMAScript 5. The statement "use strict"; instructs the browser to use the Strict mode, which is a reduced and safer feature set of JS. It's just a string you put in your JavaScript files (either at the top of your file or inside of a function) that looks like this:
"use strict";
Putting it in your code now shouldn't cause any problems with current browsers as it's just a string. It may cause problems with your code in the future if your code violates the pragma. For instance, if you currently have foo = "bar" without defining foo first, your code will start failing...which is a good thing in my opinion.
Also note you can apply "strict mode" to the whole file... Or you can use it only for a specific function :
// Non-strict code...
(function(){
"use strict";
// Define your library strictly...
})();
// Non-strict code...
Hi @evanmirk,
Thanks for the reply, although I'm not sure if it was directed at me or the original poster?
DataTables uses
"use strict"
which you'll be able to see in the source code.Allan