Javascript error when selecting "full_numbers" pagination type
Javascript error when selecting "full_numbers" pagination type
tlupan
Posts: 2Questions: 0Answers: 0
I'm using DataTables in ASP.NET MVC 2 and Internet Explorer 8.
When I change sPaginationType to "full_numbers," the paging html shows up fine. However, when I click on one of the paging buttons, I get the following javascript error:
Line: 482
Error: 'jQuery.fn.dataTableExt.oPagination' is null or not an object
To fix this, I changed line 482 in jquery.dataTables.js to the following:
var iPageCount = _oExt.oPagination.iFullNumbersShowPages;
I basically swapped out "jQuery.fn.dataTableExt" with "_oExt."
When I change sPaginationType to "full_numbers," the paging html shows up fine. However, when I click on one of the paging buttons, I get the following javascript error:
Line: 482
Error: 'jQuery.fn.dataTableExt.oPagination' is null or not an object
To fix this, I changed line 482 in jquery.dataTables.js to the following:
var iPageCount = _oExt.oPagination.iFullNumbersShowPages;
I basically swapped out "jQuery.fn.dataTableExt" with "_oExt."
This discussion has been closed.
Replies
This is quite odd. _oExt is === to jQuery.fn.dataTableExt so the original code should work fine, and appears to do so when used in the full_numbers demo: http://datatables.net/examples/basic_init/alt_pagination.html . Could you confirm if this works for you?
The variable should be updated to _oExt as you have done actually, that line of code that was changed predates the _oExt variable, so I will change it for the next version - but I can't explain why it would fix a Javascript error...
Regards,
Allan
I tried again with my app in IE and Firefox. Although the rows do get updated when paging, none of the paging controls get updated (i.e. "Showing 1 to 10 of x entries" doesn't change, current page number doesn't change).
Firefox says: jQuery.fn.dataTableExt is undefined - Line: 58
IE says: 'jQuery.fn.dataTableExt.oPagination' is null or not an object, Line: 59, Char: 82
The pagination seems to be working fine in both browsers until I open a modal window.
Edit:
I can confirm that the above code change fixes this as well.
Thanks very much for the confirmation. I wonder if it to do with the scoping of the jQuery object, but I'm still not sure. As far as I can see the two variables are basically the same thing :-). But the change will certainly be in 1.5.7 when released...
Thanks,
Allan
I am using
jQuery.fn.dataTableExt.oSort['natural-asc'] = function(a,b) {
return naturalSort(a,b);
};
I have the naturalSort function defined in the same js file.
I am getting this error:
jQuery.fn.dataTableExt is undefined...
I saw suggestions above and may jQuery.datatables.js already has _oExt.oSort.
Can you please let me know what is going wrong?
Thanks,
-Shaunak.