Commit eb469cb2 authored by David Stutz's avatar David Stutz

Merge pull request #177 from daftgopher/number_displayed

Add 'numberDisplayed' default to multiselect and use that to determine w...
parents 1bf82fcd c6a317bf
...@@ -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 {
...@@ -117,7 +117,8 @@ ...@@ -117,7 +117,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