Commit c6a317bf authored by Matt Waldron's avatar Matt Waldron

Add 'numberDisplayed' default to multiselect and use that to determine when to...

Add 'numberDisplayed' default to multiselect and use that to determine when to display a number in the select box
parent 1da1db9a
...@@ -57,14 +57,14 @@ ...@@ -57,14 +57,14 @@
// Default options. // Default options.
defaults: { defaults: {
// Default text function will either print 'None selected' in case no // Default text function will either print 'None selected' in case no
// option is selected, or a list of the selected options up to a length of 3 selected options. // option is selected, or a list of the selected options up to a length of 3 selected options by default.
// If more than 3 options are selected, the number of selected options is printed. // If more than 3 options are selected, the number of selected options is printed.
buttonText: function(options, select) { buttonText: function(options, select) {
if (options.length == 0) { if (options.length == 0) {
return this.nonSelectedText + ' <b class="caret"></b>'; return this.nonSelectedText + ' <b class="caret"></b>';
} }
else { else {
if (options.length > 3) { if (options.length > this.numberDisplayed) {
return options.length + ' ' + this.nSelectedText + ' <b class="caret"></b>'; return options.length + ' ' + this.nSelectedText + ' <b class="caret"></b>';
} }
else { else {
...@@ -113,7 +113,8 @@ ...@@ -113,7 +113,8 @@
filterBehavior: 'text', filterBehavior: 'text',
preventInputChangeEvent: false, preventInputChangeEvent: false,
nonSelectedText: 'None selected', nonSelectedText: 'None selected',
nSelectedText: 'selected' nSelectedText: 'selected',
numberDisplayed: 3
}, },
// Templates. // Templates.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment