Javascript error when selecting "full_numbers" pagination type

Javascript error when selecting "full_numbers" pagination type

tlupantlupan Posts: 2Questions: 0Answers: 0
edited December 2009 in Bug reports
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."

Replies

  • allanallan Posts: 63,386Questions: 1Answers: 10,449 Site admin
    Hi tlupan,

    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
  • tlupantlupan Posts: 2Questions: 0Answers: 0
    The full_numbers demo seems to work fine.

    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).
  • maliwikmaliwik Posts: 55Questions: 5Answers: 1
    edited December 2009
    I can confirm this in IE7 and Firefox as well, but only it occurs after I click on a link that opens a modal window and close the modal window (colorbox). After it closes, if I click on the pagination buttons in IE or Firefox, they will flip to the next page, but the buttons themselves won't become highlighted, and each browser throws a different error.

    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.
  • allanallan Posts: 63,386Questions: 1Answers: 10,449 Site admin
    Hi maliwik,

    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
  • ShaunakShaunak Posts: 1Questions: 0Answers: 0
    Hi,
    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.
This discussion has been closed.