IE error (Message: 'asSorting' is null or not an object)
IE error (Message: 'asSorting' is null or not an object)
ejeliot
Posts: 5Questions: 0Answers: 0
I'm getting the following error in IE 8 (and most likely 6 & 7):
Message: 'asSorting' is null or not an object
Line: 6454
Char: 6
Code: 0
This may or may not be related to the issue and associated change described in:
http://datatables.net/forums/comments.php?DiscussionID=2451&page=1#Item_5
Message: 'asSorting' is null or not an object
Line: 6454
Char: 6
Code: 0
This may or may not be related to the issue and associated change described in:
http://datatables.net/forums/comments.php?DiscussionID=2451&page=1#Item_5
This discussion has been closed.
Replies
Allan
Allan
you have to use the - Tags around the markup used for the title-row of the table.
Sascha
Example:
[code]
var oTable = $('#table').dataTable({
"aaSorting": [[ 2, "desc" ]]
...
[/code]
With 3 columns, this is ok (column "2" is the zero-indexed column "3").
With 2 columns, this will result in "asSorting' is null or not an object" because column "2" doesn't exist when referring to columns in zero-indexed values.
Took a few minutes to figure out, hope this saves someone else a bit of time.
@ejeliot:
you have to use the - Tags around the markup used for the title-row of the table.
Sascha
>>> You were right at least with my issue. i got the same error message i finally get the correct dynamic table structure as :
x NColumns
x NColumns
x MRows
and it works!. issue solved
thanks a lot Sascha, you saved me, a lot of time :)
Thxs
HTML:
JS:
$('#table0').dataTable({
bJQueryUI: true,
bSort: false
});
Solution was:
$('#table0').dataTable({
bJQueryUI: true,
bSort: false,
aoData: [{}]
});
The issue was caused by dataTable trying to apply initial sorting criteria on a 0 column when no columns have been found. So it tried to apply the initial default sorting criteria [[0,'asc',0]] on an 'unidentified' column.
Thanks very much for your post! DataTables doesn't actually allow columns to be added or removed after initialisation and if no column / row information is passed in (its perfectly possibly to write a plug-in API method that will do that, but not yet done - still on the list :-) ), so a table with no columns isn't actually going to be all that useful.
What was your use case for doing it this way?
Allan
That's what I actually need. I'm trying to have some initial settings to display the table (with style applied and properly re-sized) and then to load the rest of settings, and after that to load the actual data. Settings can vary base on a button you click (data can vary either).
So far the only way I found to achieve this is to re-create dataTable with new settings, or (as you say) to write a plug-in method that does something similar to what dataTable does to "oInit", but applies changes to the current instance of dataTable.
AnthonyP