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 @@
// Default options.
defaults: {
// 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.
buttonText: function(options, select) {
if (options.length == 0) {
return this.nonSelectedText + ' <b class="caret"></b>';
}
else {
if (options.length > 3) {
if (options.length > this.numberDisplayed) {
return options.length + ' ' + this.nSelectedText + ' <b class="caret"></b>';
}
else {
......@@ -113,7 +113,8 @@
filterBehavior: 'text',
preventInputChangeEvent: false,
nonSelectedText: 'None selected',
nSelectedText: 'selected'
nSelectedText: 'selected',
numberDisplayed: 3
},
// 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