mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-28 02:58:18 +08:00
Ui: Allow Ctrl-A and Ctrl-X in multi-select2 field
This commit is contained in:
@@ -200,6 +200,22 @@ var View = Backbone.View.extend({
|
||||
if (this.options.searchable) {
|
||||
this.$select.select2('destroy');
|
||||
this.$select.select2();
|
||||
this.$('.select2-input').off('keypress.selectall').on('keypress.selectall', function(event){
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
var id = $(this).parents('div[class*="select2-container"]').attr('id').replace('s2id_', '');
|
||||
var element = $('#' + id);
|
||||
if (event.which == 97){
|
||||
var selected = [];
|
||||
element.find('option').each(function(i, e){
|
||||
selected[selected.length] = $(e).attr('value');
|
||||
});
|
||||
element.select2('val', selected);
|
||||
} else if (event.which == 120){
|
||||
element.select2('val', '');
|
||||
}
|
||||
$('.select2-drop-mask').click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// set previous value
|
||||
|
||||
Reference in New Issue
Block a user