Skip to content

Instantly share code, notes, and snippets.

@ova2
Created September 27, 2012 10:09
Show Gist options
  • Save ova2/3793265 to your computer and use it in GitHub Desktop.
Save ova2/3793265 to your computer and use it in GitHub Desktop.
DataTable performance problem in IE with checkboxes / radio buttons
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