Skip to content

Commit 31c87b2

Browse files
committed
Fix #630
ALT-A checks all ALT-U unchecks all Adding braces to some if statements that did not have them.
1 parent 5943283 commit 31c87b2

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

src/jquery.multiselect.filter.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,21 @@
6767
// prevent the enter key from submitting the form / closing the widget
6868
if(e.which === 13) {
6969
e.preventDefault();
70-
} else if(e.which === 82 && e.altKey) {
71-
e.preventDefault();
72-
$(this).val('').trigger('input', '');
7370
} else if(e.which === 27) {
7471
elem.multiselect('instance').close();
72+
} else if(e.altKey) {
73+
switch(e.which) {
74+
case 82:
75+
e.preventDefault();
76+
$(this).val('').trigger('input', '');
77+
break;
78+
case 65:
79+
elem.multiselect('instance').checkAll();
80+
break;
81+
case 85:
82+
elem.multiselect('instance').uncheckAll();
83+
break;
84+
}
7585
}
7686
},
7787
input: $.proxy(debounce(this._handler, opts.debounceMS), this),

src/jquery.multiselect.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@
8686
.html(function() {
8787
if(o.header === true) {
8888
var header_lis = '';
89-
if(o.showCheckAll)
89+
if(o.showCheckAll) {
9090
header_lis = '<li><a class="ui-multiselect-all" href="#"><span class="ui-icon ui-icon-check"></span><span>' + o.checkAllText + '</span></a></li>';
91-
if(o.showUncheckAll)
91+
}
92+
if(o.showUncheckAll) {
9293
header_lis += '<li><a class="ui-multiselect-none" href="#"><span class="ui-icon ui-icon-closethick"></span><span>' + o.uncheckAllText + '</span></a></li>';
94+
}
9395
return header_lis;
9496
} else if(typeof o.header === "string") {
9597
return '<li>' + o.header + '</li>';
@@ -363,10 +365,12 @@
363365
}
364366
})
365367
.delegate('label', 'keydown.multiselect', function(e) {
366-
if(e.which === 82)
368+
if(e.which === 82) {
367369
return; //"r" key, often used for reload.
368-
if(e.which > 111 && e.which < 124)
370+
}
371+
if(e.which > 111 && e.which < 124) {
369372
return; //Keyboard function keys.
373+
}
370374
e.preventDefault();
371375
switch(e.which) {
372376
case 9: // tab
@@ -382,6 +386,16 @@
382386
case 13: // enter
383387
$(this).find('input')[0].click();
384388
break;
389+
case 65:
390+
if(e.altKey) {
391+
self.checkAll();
392+
}
393+
break;
394+
case 85:
395+
if(e.altKey) {
396+
self.uncheckAll();
397+
}
398+
break;
385399
}
386400
})
387401
.delegate('input[type="checkbox"], input[type="radio"]', 'click.multiselect', function(e) {

0 commit comments

Comments
 (0)