IE Specific Pagination bug (Description and Fix included)
IE Specific Pagination bug (Description and Fix included)
offsound
Posts: 2Questions: 0Answers: 0
Hello,
I was answering a question on stackoverflow, and ran into a dataTables bug that I thought you guys should know about.
Here's the question that describes the problem: http://stackoverflow.com/questions/9629296/jquery-datatable-pagination-issue-in-ie9
I narrowed it down to this function, which is around line 4613 of http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.0/jquery.dataTables.js :
[code]
function _fnBindAction( n, oData, fn )
{
$(n)
.bind( 'click.DT', oData, function (e) {
fn(e);
n.blur(); // Remove focus outline for mouse users
})
.bind( 'keypress.DT', oData, function (e){
if ( e.which === 13 ) {
fn(e);
}})
.bind( 'selectstart.DT', function () {
/* Take the brutal approach to cancelling text selection */
return false;
});
}
[/code]
In IE9 (didn't test against earlier versions), it's having trouble with what appears to be the scoping of the `n` variable. When you click on a page number in the pagination bar, you get the following error message:
[code]
Line: 4613
Error: Unexpected call to method or property access.
[/code]
However, It works fine (or is ignored) in other browsers. I was able to fix this issue by changing n.blur(); to $(n).blur() on line 4613.
There might be a better solution, but this seems to fix it for me -- and it still works in the other browsers.
Thanks,
Josh
I was answering a question on stackoverflow, and ran into a dataTables bug that I thought you guys should know about.
Here's the question that describes the problem: http://stackoverflow.com/questions/9629296/jquery-datatable-pagination-issue-in-ie9
I narrowed it down to this function, which is around line 4613 of http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.0/jquery.dataTables.js :
[code]
function _fnBindAction( n, oData, fn )
{
$(n)
.bind( 'click.DT', oData, function (e) {
fn(e);
n.blur(); // Remove focus outline for mouse users
})
.bind( 'keypress.DT', oData, function (e){
if ( e.which === 13 ) {
fn(e);
}})
.bind( 'selectstart.DT', function () {
/* Take the brutal approach to cancelling text selection */
return false;
});
}
[/code]
In IE9 (didn't test against earlier versions), it's having trouble with what appears to be the scoping of the `n` variable. When you click on a page number in the pagination bar, you get the following error message:
[code]
Line: 4613
Error: Unexpected call to method or property access.
[/code]
However, It works fine (or is ignored) in other browsers. I was able to fix this issue by changing n.blur(); to $(n).blur() on line 4613.
There might be a better solution, but this seems to fix it for me -- and it still works in the other browsers.
Thanks,
Josh
This discussion has been closed.
Replies
Can you link me to a test page which does show the issue? Your fix looks absolutely fine, but I'd just like to check that there isn't something "deeper" going on.
Thanks,
Allan
[code]
"sPaginationType": "full_numbers"
[/code]
And then you click on any of the pagination numbers on the bottom right.
It doesn't seem to have any adverse effects, but if you look at the developer console (f12 in IE) you get that error, every time you click on a page number.
jsfiddle has been down, so I had to use this site: http://plunker.no.de/he7GGr/
You can run the above link and see the error in IE, but the plunker editor doesn't seem to like IE, so open this next link in a real browser: http://plunker.no.de/edit/he7GGr if you want to see the source.
By the way, thanks for creating/maintaining dataTables. It's been one of the most useful plugins I've worked with in jQuery.
- Josh
> By the way, thanks for creating/maintaining dataTables. It's been one of the most useful plugins I've worked with in jQuery.
Thanks very much! :-)
Allan
Eagerly waiting for 1.9.1 with the fix.
Regards,
Allan