Skip to content

Commit ffd19b3

Browse files
authored
Merge pull request #672 from andrehtissot/master
Added "showCheckAll" and "showUncheckAll" options, defaulted to true. Also updated keyboard shortcuts so the open menu doesn't interfere with ctrl-r refreshes or the function keys.
2 parents 9811e95 + d4cc630 commit ffd19b3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/jquery.multiselect.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
checkAllText: 'Check all',
3535
uncheckAllText: 'Uncheck all',
3636
noneSelectedText: 'Select options',
37+
showCheckAll: true,
38+
showUncheckAll: true,
3739
selectedText: '# selected',
3840
selectedList: 0,
3941
closeIcon: 'ui-icon-circle-close',
@@ -83,7 +85,12 @@
8385
.addClass('ui-helper-reset')
8486
.html(function() {
8587
if(o.header === true) {
86-
return '<li><a class="ui-multiselect-all" href="#"><span class="ui-icon ui-icon-check"></span><span>' + o.checkAllText + '</span></a></li><li><a class="ui-multiselect-none" href="#"><span class="ui-icon ui-icon-closethick"></span><span>' + o.uncheckAllText + '</span></a></li>';
88+
var header_lis = '';
89+
if(o.showCheckAll)
90+
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)
92+
header_lis += '<li><a class="ui-multiselect-none" href="#"><span class="ui-icon ui-icon-closethick"></span><span>' + o.uncheckAllText + '</span></a></li>';
93+
return header_lis;
8794
} else if(typeof o.header === "string") {
8895
return '<li>' + o.header + '</li>';
8996
} else {
@@ -356,8 +363,11 @@
356363
}
357364
})
358365
.delegate('label', 'keydown.multiselect', function(e) {
366+
if(e.which === 82)
367+
return; //"r" key, often used for reload.
368+
if(e.which > 111 && e.which < 124)
369+
return; //Keyboard function keys.
359370
e.preventDefault();
360-
361371
switch(e.which) {
362372
case 9: // tab
363373
case 27: // esc

0 commit comments

Comments
 (0)