FSN#38633 Op hele TD kunnen klikken voor multi-select checkbox
svn path=/Website/trunk/; revision=31839
This commit is contained in:
@@ -64,11 +64,34 @@ $(document).ready(function() {
|
||||
});
|
||||
};
|
||||
var lastChecked = null;
|
||||
function kliklist (doMulti)
|
||||
{
|
||||
$(this).closest("tr").toggleClass("selected", this.checked);
|
||||
if(!lastChecked) {
|
||||
lastChecked = this;
|
||||
return;
|
||||
}
|
||||
|
||||
if(doMulti)
|
||||
{
|
||||
window.getSelection().removeAllRanges(); // Anders blijft door de shift tekst geselecteerd
|
||||
$chkboxes = $('input.multiselect');
|
||||
var start = $chkboxes.index(this);
|
||||
var end = $chkboxes.index(lastChecked);
|
||||
|
||||
$chkboxes.slice(Math.min(start,end), Math.max(start,end)+ 1)
|
||||
.prop('checked', lastChecked.checked)
|
||||
.closest("tr").toggleClass("selected", lastChecked.checked);
|
||||
}
|
||||
lastChecked = this;
|
||||
}
|
||||
$(document).ready(function() {
|
||||
// Op hele TD klikken voor checkbox
|
||||
$('td:has(:checkbox.multiselect)').click(function (e) {
|
||||
if (!$(e.target).is('input')) {
|
||||
$('input:checkbox', this).click();
|
||||
if (!$(e.target).is('input'))
|
||||
{
|
||||
$('input:checkbox', this).prop('checked',!$('input:checkbox', this).prop('checked'));
|
||||
kliklist.apply($('input:checkbox', this)[0], [e.shiftKey]);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@@ -76,23 +99,8 @@ $(document).ready(function() {
|
||||
// Bij multi-select Shift-toets gebruiken voor een range
|
||||
var $chkboxes = $('input.multiselect');
|
||||
$chkboxes.click(function(e) {
|
||||
$(this).closest("tr").toggleClass("selected", this.checked);
|
||||
$chkboxes = $('input.multiselect');
|
||||
if(!lastChecked) {
|
||||
lastChecked = this;
|
||||
return;
|
||||
}
|
||||
|
||||
if(e.shiftKey) {
|
||||
var start = $chkboxes.index(this);
|
||||
var end = $chkboxes.index(lastChecked);
|
||||
|
||||
$chkboxes.slice(Math.min(start,end), Math.max(start,end)+ 1)
|
||||
.prop('checked', lastChecked.checked)
|
||||
.closest("tr").toggleClass("selected", lastChecked.checked);
|
||||
}
|
||||
lastChecked = this;
|
||||
});
|
||||
kliklist.apply(this, [e.shiftKey]);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user