Commit d3e9b9df authored by Kuiyu CHANG's avatar Kuiyu CHANG

added delimiter option to control the delimiter character for mouse-over display of selected items

parent c8351a6f
...@@ -223,8 +223,9 @@ ...@@ -223,8 +223,9 @@
} }
else { else {
var selected = ''; var selected = '';
var delimiter = this.delimiter;
options.each(function () { options.each(function () {
selected += $(this).text() + ', '; selected += $(this).text() + delimiter;
}); });
return selected.substr(0, selected.length - 2); return selected.substr(0, selected.length - 2);
} }
...@@ -317,6 +318,7 @@ ...@@ -317,6 +318,7 @@
allSelectedText: 'All selected', allSelectedText: 'All selected',
numberDisplayed: 3, numberDisplayed: 3,
disableIfEmpty: false, disableIfEmpty: false,
delimiter: ', ',
templates: { templates: {
button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"><span class="multiselect-selected-text"></span> <b class="caret"></b></button>', button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"><span class="multiselect-selected-text"></span> <b class="caret"></b></button>',
ul: '<ul class="multiselect-container dropdown-menu"></ul>', ul: '<ul class="multiselect-container dropdown-menu"></ul>',
......
...@@ -453,6 +453,37 @@ ...@@ -453,6 +453,37 @@
</pre> </pre>
</td> </td>
</tr> </tr>
<tr>
<td><code>delimiter</code></td>
<td>
<p>
Sets the separator for the list of selected items for mouse-over. Defaults to ', '. Set to '\n' for a neater display.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-delimiter').multiselect({
delimiter: '\n'
});
});
</script>
<select id="example-delimiter" multiple="multiple"></select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {
$('#example-delimiter').multiselect({
delimiter: '\n'
});
});
&lt;/script&gt;
</pre>
</div>
</td>
</tr>
<tr> <tr>
<td><code>disableIfEmpty</code></td> <td><code>disableIfEmpty</code></td>
<td> <td>
......
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