Hi All,
is there anyway to enable bulk selection with Shift key? There is a similar case on github.
I tried adding below code sample to my selection but even though I could use shift key to select multiple options, I lost select2 dynamic features?
var count_shift = 0;
var shift_array = [];
var options_selected = [];
$j(".assigneeSelection").on(“select2:select”, function (e) {
if (e.shiftKey) {
shift_array.push(e.params.data.element.index);
count_shift++;
}
if( count_shift == 2 ){
for (var i = shift_array[0]; i <= shift_array[1]; i++) {
var option_value = $j(’.select2-shift option’).eq(i).val();
options_selecteds.push(option_value);
}
$j(’.select2-shift’).val(options_selecteds);
$j(’.select2-shift’).trigger(‘change’);
$j(’.select2-shift’).select2(‘close’);
count_shift = 0;
shift_array = [];
options_selecteds = [];
}
});