Skip to content

Commit

Permalink
Added option for #466 - although this may be handled easier by direct…
Browse files Browse the repository at this point in the history
…ly modifying the buttonText option!
  • Loading branch information
davidstutz committed Feb 28, 2015
1 parent 07398c0 commit 7ee176a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dist/js/bootstrap-multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,12 @@
return this.nonSelectedText;
}
else if (this.allSelectedText && options.length == $('option', $(select)).length) {
return this.allSelectedText;
if (this.selectAllNumber) {
return this.allSelectedText + ' (' + options.length + ')';
}
else {
return this.allSelectedText;
}
}
else if (options.length > this.numberDisplayed) {
return options.length + ' ' + this.nSelectedText;
Expand Down Expand Up @@ -306,6 +311,7 @@
selectAllText: ' Select all',
selectAllValue: 'multiselect-all',
selectAllName: false,
selectAllNumber: true,
enableFiltering: false,
enableCaseInsensitiveFiltering: false,
enableClickableOptGroups: false,
Expand Down
41 changes: 41 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,47 @@ <h2 id="configuration-options">Configuration Options</h2>
});
});
&lt;/script&gt;
</pre>
</div>
</td>
</tr>
<tr>
<td>
<code>selectAllNumber</code>
</td>
<td>
<p>
If set to <code>true</code> (default), the number of selected options will be shown in parantheses when all options are seleted. The below example shows the behavior of the selectalloption with <code>selectAllNumber</code> set to <code>false</code>:
</p>

<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-selectAllNumber').multiselect({
includeSelectAllOption: true,
selectAllNumber: false
});
});
</script>
<select id="example-selectAllNumber" multiple="multiple">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {
$('#example-selectAllNumber').multiselect({
includeSelectAllOption: true,
selectAllNumber: false
});
});
&lt;/script&gt;
</pre>
</div>
</td>
Expand Down

0 comments on commit 7ee176a

Please sign in to comment.