Created
September 27, 2012 10:09
-
-
Save ova2/3793265 to your computer and use it in GitHub Desktop.
DataTable performance problem in IE with checkboxes / radio buttons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bindCheckboxEvents: function() { | |
... | |
A HUGE PERFORMANCE PROBLEM WITH THE CODE BELOW | |
//keyboard support | |
$(document).off('focus.ui-chkbox blur.ui-chkbox keydown.ui-chkbox keyup.ui-chkbox', checkboxInputSelector) | |
.on('focus.ui-chkbox', checkboxInputSelector, null, function() { | |
var input = $(this), | |
box = input.parent().next(); | |
if(input.prop('checked')) { | |
box.removeClass('ui-state-active'); | |
} | |
box.addClass('ui-state-focus'); | |
}) | |
.on('blur.ui-chkbox', checkboxInputSelector, null, function() { | |
var input = $(this), | |
box = input.parent().next(); | |
if(input.prop('checked')) { | |
box.addClass('ui-state-active'); | |
} | |
box.removeClass('ui-state-focus'); | |
}) | |
.on('keydown.ui-chkbox', checkboxInputSelector, null, function(e) { | |
var keyCode = $.ui.keyCode; | |
if(e.which == keyCode.SPACE) { | |
e.preventDefault(); | |
} | |
}) | |
.on('keyup.ui-chkbox', checkboxInputSelector, null, function(e) { | |
var keyCode = $.ui.keyCode; | |
if(e.which == keyCode.SPACE) { | |
var input = $(this), | |
box = input.parent().next(); | |
if(input.prop('checked')) { | |
_self.unselectRowWithCheckbox(box); | |
} | |
else { | |
_self.selectRowWithCheckbox(box); | |
} | |
e.preventDefault(); | |
} | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment