jQuery.Deferred exception: 'dataTablesConditionalFormatting' is undefined ReferenceError: 'dataTable
jQuery.Deferred exception: 'dataTablesConditionalFormatting' is undefined ReferenceError: 'dataTable
Link to test case:
Since the issue only happens in IE you would need to save the content from codepen directly to . HTML file and run it locally (that's where I have the error): https://codepen.io/MadBoyEvo/pen/JjEWdog - It works fine in Chrome/Firefox/Edge - just fails in IE.
Error messages shown:
This is shownly in Internet Explorer:
jQuery.Deferred exception: 'dataTablesConditionalFormatting' is undefined ReferenceError: 'dataTablesConditionalFormatting' is undefined
at rowCallback (file:///C:/Support/GitHub/PSWriteHTML/Examples/Example-Table/Example-TableJavaScriptConditions.html:408:37)
at Anonymous function (https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js:93:128)
at map (https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js:2:3500)
Description
When you open the file in any browser except IE it works fine and columns are highlighted properly. If you open it up IE it fails with error referring to my function not being defined which is not the case. Any idea how to make it compatible?
This question has accepted answers - jump to:
Answers
Checkout this SO thread. Sounds like you might need to move your functions from the
head
to thebody
for IE.Kevin
I tried all 3. Initially, I had it in the footer and it worked for everything except IE. I've moved it to head and still no luck, now moved it to the body before and after content - no luck.
Sorry, I don't have IE to test with. But it seems to be more specific to IE than Datatables. although @allan or @colin may have some insight and help. But I would look on Stack Overflow or other resources for other options.
Another test you can try, if you want to eliminate Datatables as the problem, is to simply call the function in
$(document).ready()
with some fake parameters to see if its found using IE.Kevin
I don't have an IE VM to hand either I'm afraid - I'll try to take a look on a Windows laptop later, but I suspect it is just some quirk of IE's JS engine. I don't see anything obviously wrong there. What happens if you move the
dataTablesConditionalFormatting
function into the same <script> block as the DataTable initialisation?Allan
When I move the function inside same scriptblock the error is not there... but the visual part of the table is broken.
However I initially ignored that before that error there is:
SCRIPT1004: Expected ';' and when I click to see where it is it points to middle of
for (let value of conditionValue)
which i initially just shrugged of.. but after moving the function into same scriptblock the error is gone, but this error doubles down.And when I check
for...of
docs it seems IE is not compatible - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...ofSo I guess this could be the reason for it failing...
I've resolved my issue. It seems there were two problems:
1.
for of
2.
conditionsMatch.every(value => value === true)
andconditionsMatch.some(value => value === true)
So I started replacing for/of with
With old way
And things like:
With
It now works in IE 11.
https://codepen.io/MadBoyEvo/pen/OJWpXde
Ah - I missed that you were using some more modern code. Yup - that would do it. Did IE not throw a syntax error in its console for that?
Good to hear you have it working now though.
Allan
It did, but in such a way that it threw me off into focusing on different issues ;-) Take a look
https://i.imgur.com/vLvsz7k.png
2nd screen is when I clicked on the 1st error.