Pagination Buttons not shown initially on IE 9

Pagination Buttons not shown initially on IE 9

PriyaRajPriyaRaj Posts: 1Questions: 1Answers: 0
edited October 2014 in Free community support

Hi , i am using your jquery databale pagination . The pagination works very fine . But in IE 9 , the pagination buttons (First , last ,Previous) is not displayed on initial page load. if we do any action in the page , like search , submit , then the pagination buttons (First , last ,Previous) gets displayed.

Code i am using in my XHTML page :
$(document).ready(function() {
$('#Tb').dataTable({
"pagingType" : "full_numbers",
"sDom" : 'ltipr',
"aLengthMenu" : [ 10 ],
'bLengthChange' : false,
"bSort": false,
"language": {
"info": "Showing page PAGE of PAGES"
}
});
});
I have included the datatable css and datatable js in my page.

Answers

  • helenmhelenm Posts: 2Questions: 0Answers: 0

    I have the same problem in IE9 -- "dataTables_paginate" element is empty until I do a search or change the number of visible entries. I have the simplest of tables, no options at all. Any suggestions?

  • helenmhelenm Posts: 2Questions: 0Answers: 0

    Upon more research, I found that ie9 throws an exception when using document.activeElement inside an iframe (which my table is) that is caught but prevents the buttons from being attached. I moved the button attaching code to a finally clause which seems to have solved the problem. For anyone interested, in jquery.dataTables.js (version 1.10.4) I replaced lines 14183-14199 with the following:

    // IE9 throws an 'unknown error' if document.activeElement is used
    // inside an iframe or frame. Try / catch the error. Not good for
    // accessibility, but neither are frames.
    var activeEl = null;
    try {
        // Because this approach is destroying and recreating the paging
        // elements, focus is lost on the select button which is bad for
        // accessibility. So we want to restore focus once the draw has
        // completed
        activeEl = $(document.activeElement).data('dt-idx');
    }
        catch (e) {
    }
    finally {
        // Attach the buttons regardless of whether activeElement worked or not
        attach( $(host).empty(), buttons );
    
        if ( activeEl !== null ) {
            $(host).find( '[data-dt-idx='+activeEl+']' ).focus();
        }
    }
    
  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin

    Hi,

    Thanks for your research into this issue! I've just committed the fix and the nightly will shortly be up-to-date with the change. This will be in 1.10.5 next week.

    Regards,
    Allan

This discussion has been closed.