Android runtime exception

Android runtime exception

Boilermaker80Boilermaker80 Posts: 19Questions: 6Answers: 0

I'm working on a browser page that uses DataTables and loading data using Ajax/JSON. It works perfectly in the latest version of Chrome running under Windows 10, but not in Firefox, Opera, MS Edge or IE on the same PC, and not on my Android phone or tablet in any browser.

Developer tools tell me that I'm getting an "e[i] not defined" exception when the data is sorted, thrown by jQuery. I'm using:

https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js,

https://cdn.datatables.net/v/dt/dt-1.10.18/b-1.5.2/cr-1.5.0/sl-1.2.6/datatables.min.js and

https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js.

My DataTable is initialized as follows:

$(document).ready(function() {$('#fileTable').DataTable({'columns':[{'data':'filename'},{'data':'created'},{'data':'modified'},{'data':'type'},{'data':'size'}],select:{style:'os'},'order':[['filename','asc']],ajax:{url:'/getFiles?/'},paging:false,scrollY:'100%',stateSave:true,stateDuration:-1});});

It's defined in HTML like this (leading "<" deliberately removed to prevent it from rendering):

table id="fileTable" class="display hover dataTable" style="width:100%;"><thead><tr><th style="width:51%;">Name</th><th style="width:17%;">Date Created</th><th style="width:17%;">Date Modified</th><th style="width:5%;">Type</th><th style="width:10%;">Size</th></tr></thead><tbody></tbody></table>"'''

My JSON data looks like this:

{
"status" : "success",
"data" : [
{
"filename" : "fileMain.htm",
"created" : "08/15/2018 17:22:00",
"modified" : "07/31/2018 17:04:00",
"type" : "htm",
"size" : "2210"
},
{
"filename" : "test.htm",
"created" : "08/15/2018 17:22:00",
"modified" : "08/14/2018 11:16:00",
"type" : "htm",
"size" : "3726"
},
{
"filename" : "text.txt",
"created" : "09/18/2018 12:25:00",
"modified" : "07/31/2018 17:16:00",
"type" : "txt",
"size" : "169"
}
]
}

I found a number of posts with similar problems, usually related to getting the column number wrong in the sort order. But my column names seem to match my data and I sort by column name rather than number. What am I missing?

IE 11.665.16299.0 provided this call trace:

jQuery.Deferred exception: Unable to get property 'aDataSort' of undefined or null reference TypeError: Unable to get property 'aDataSort' of undefined or null reference
at X (https://cdn.datatables.net/v/dt/dt-1.10.18/b-1.5.2/cr-1.5.0/sl-1.2.6/datatables.min.js:78:150)
at wa (https://cdn.datatables.net/v/dt/dt-1.10.18/b-1.5.2/cr-1.5.0/sl-1.2.6/datatables.min.js:82:282)
at e (https://cdn.datatables.net/v/dt/dt-1.10.18/b-1.5.2/cr-1.5.0/sl-1.2.6/datatables.min.js:103:115)
at b (https://cdn.datatables.net/v/dt/dt-1.10.18/b-1.5.2/cr-1.5.0/sl-1.2.6/datatables.min.js:85:464)
at Jb (https://cdn.datatables.net/v/dt/dt-1.10.18/b-1.5.2/cr-1.5.0/sl-1.2.6/datatables.min.js:86:52)
at Anonymous function (https://cdn.datatables.net/v/dt/dt-1.10.18/b-1.5.2/cr-1.5.0/sl-1.2.6/datatables.min.js:105:107)
at each (https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:2563)
at w.prototype.each (https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:1231)
at n (https://cdn.datatab

This question has an accepted answers - jump to answer

Answers

  • Boilermaker80Boilermaker80 Posts: 19Questions: 6Answers: 0

    6:45 EDT, something has changed without any code changes and now the same version of my web page that worked properly on Chrome under Windows 10 doesn't. At least it's consistent now :blush:

  • Boilermaker80Boilermaker80 Posts: 19Questions: 6Answers: 0

    Solved - I replaced 'order':[['filename','asc']] with 'order':[[0,'asc']]. Still... shouldn't it be possible to specify sort order by column name?

  • allanallan Posts: 61,840Questions: 1Answers: 10,134 Site admin
    Answer ✓

    Still... shouldn't it be possible to specify sort order by column name?

    Currently no, it isn't possible. But yes, it is a limitation I'm aware of and is on the task list!

    Allan

This discussion has been closed.