I'm trying to make a table support multiple row selection (for the moment just the CTRL + mouseclick combination). Everything works fine, but when I click outside the table area, the rows don't deselect. Unfortunately, I have found out that the focusout
event doesn't trigger at all. Here's my code:
$(".library tbody tr").live('click', function (event) {
event.preventDefault();
if (event.ctrlKey) {
$(this).toggleClass('selected-row');
} else {
$(".library tbody tr").removeClass("selected-row");
$(this).addClass("selected-row");
}
});
$("table.library").live('click', function () {
$(".library").addClass("focused");
});
$("table.library").live('focusout', function () {
$(this).removeClass("focused");
});
Has anyone else dealt with this issue?