Commit 4aa63626 authored by Tyf0x's avatar Tyf0x

** Fix for #427 **

-> Added setAllSelectedText function to set the text displayed when all options are selected dynamically at runtime
-> Updated doc
parent 847873e4
......@@ -1243,6 +1243,11 @@
return setTimeout(function() {
callback.apply(self || window, args);
}, timeout);
},
setAllSelectedText: function(allSelectedText) {
this.options.allSelectedText = allSelectedText;
this.updateButtonText();
}
};
......
......@@ -2851,6 +2851,48 @@
$('#example-dataprovider-optgroups').multiselect('dataprovider', optgroups);
</script>
<select id="example-dataprovider-optgroups" multiple="multiple"></select>
</pre>
</div>
</td>
</tr>
<tr>
<td>
<code>.multiselect('setAllSelectedText', value)</code>
</td>
<td>
<p>
This method is used to programmatically provide a new text to display in the button when all options are selected, at runtime.
</p>
<div class="example">
<div class="btn-group">
<script type="text/javascript">
$(document).ready(function() {
$('#example-set-all-selected-text').multiselect({allSelectedText: "Initial All Selected"});
$('#new-all-selected-text-btn').click(function(){
$('#example-set-all-selected-text').multiselect('setAllSelectedText', $('#new-all-selected-text-box').val());
});
});
</script>
<select id="example-set-all-selected-text" multiple="multiple">
<option value="1" selected>Option 1</option>
</select>
<input id="new-all-selected-text-box" type="text" class="form-control" placeholder="Enter new text"/>
<input id="new-all-selected-text-btn" type="button" class="btn btn-default" value="Change All Selected Text"/>
</div>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
&lt;script type=&quot;text/javascript&quot;&gt;
$('#example-set-all-selected-text').multiselect({allSelectedText: "Initial All Selected"});
$('#new-all-selected-text-btn').click(function(){
$('#example-set-all-selected-text').multiselect('setAllSelectedText', $('#new-all-selected-text-box').val());
});
&lt;/script&gt;
</pre>
</div>
</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