Skip to content

Commit 87581a5

Browse files
committed
eanble shift select multi checkboxes
1 parent 7013e17 commit 87581a5

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

jquery.filters.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,14 @@
510510
// looking for all the popups and attaching event listener
511511
function bindHiddenPopupsOpened(){
512512
$('.bootstrap-modal-js').each(function(i, modal){
513+
// enable the user to type directly in the search input
514+
// without having to select it using the mouse
513515
$('#'+modal.id).on('shown.bs.modal', function (e) {
514516
$(this).find('.search-filters-js').focus()
515-
})
517+
});
518+
519+
//enable shift + select multi checkboxes
520+
$('#'+modal.id + ' input[type="checkbox"]').shiftSelectable()
516521
});
517522
}
518523

@@ -762,10 +767,7 @@
762767

763768
$('#daterange').on('apply.daterangepicker', function(ev, picker) {
764769
addDateSelectedToDataModal($(this).closest('.select-parameter-box'));
765-
});
766-
767-
$('#daterange').on('cancel.daterangepicker', function(ev, picker) {
768-
//do something, like clearing an input
770+
}).on('cancel.daterangepicker', function(ev, picker) {
769771
$('#daterange input').val('');
770772
addDateSelectedToDataModal($(this).closest('.select-parameter-box'));
771773
});
@@ -949,7 +951,6 @@
949951
filterModal.filters[parameter.attributeName] = parameter;
950952
}
951953

952-
953954
var serverParameterName = parameter.attributeName,
954955
humanParameterName = parameter.name,
955956
selected = [];
@@ -991,18 +992,18 @@
991992
var lastChecked,
992993
$boxes = this;
993994

994-
$boxes.click(function(evt) {
995+
$boxes.click(function(event) {
995996
if(!lastChecked) {
996997
lastChecked = this;
997998
return;
998999
}
9991000

1000-
if(evt.shiftKey) {
1001-
var start = $boxes.index(this),
1002-
end = $boxes.index(lastChecked);
1003-
$boxes.slice(Math.min(start, end), Math.max(start, end) + 1)
1004-
.attr('checked', lastChecked.checked)
1005-
.trigger('change');
1001+
if(event.shiftKey) {
1002+
var start = $boxes.index(this);
1003+
var end = $boxes.index(lastChecked);
1004+
1005+
$boxes.slice(Math.min(start,end), Math.max(start,end)+ 1).prop('checked', lastChecked.checked);
1006+
10061007
}
10071008

10081009
lastChecked = this;

0 commit comments

Comments
 (0)