Commit 1da1db9a authored by David Stutz's avatar David Stutz

#171

parent 83fa65fc
...@@ -110,10 +110,6 @@ ...@@ -110,10 +110,6 @@
buttonClass: 'btn btn-default btn-sm' buttonClass: 'btn btn-default btn-sm'
}); });
$('#example5').multiselect({
buttonClass: 'btn btn-primary disabled'
});
$('#example6').multiselect(); $('#example6').multiselect();
$('#example9').multiselect({ $('#example9').multiselect({
...@@ -276,21 +272,6 @@ ...@@ -276,21 +272,6 @@
Small button using <code>buttonClass: &apos;btn btn-default btn-sm&apos;</code>. Small button using <code>buttonClass: &apos;btn btn-default btn-sm&apos;</code>.
</td> </td>
</tr> </tr>
<tr>
<td>
<select id="example5" multiple="multiple">
<option value="cheese">Cheese</option>
<option value="tomatoes">Tomatoes</option>
<option value="mozarella">Mozzarella</option>
<option value="mushrooms">Mushrooms</option>
<option value="pepperoni">Pepperoni</option>
<option value="onions">Onions</option>
</select>
</td>
<td>
Disabled using <code>buttonClass: &apos;btn btn-primary disabled&apos;</code>.
</td>
</tr>
<tr> <tr>
<td> <td>
<div class="input-group btn-group"> <div class="input-group btn-group">
...@@ -852,6 +833,16 @@ ...@@ -852,6 +833,16 @@
$('#example18-mushrooms').on('click', function() { $('#example18-mushrooms').on('click', function() {
$('#example18').multiselect('deselect', 'mushrooms'); $('#example18').multiselect('deselect', 'mushrooms');
}); });
$('#example35').multiselect();
$('#example35-disable').on('click', function() {
$('#example35').multiselect('disable');
});
$('#example36').multiselect();
$('#example36-enable').on('click', function() {
$('#example36').multiselect('enable');
});
}); });
</script> </script>
<table class="table table-striped"> <table class="table table-striped">
...@@ -988,6 +979,48 @@ $(&quot;#multiselect&quot;).multiselect('dataprovider', data); ...@@ -988,6 +979,48 @@ $(&quot;#multiselect&quot;).multiselect('dataprovider', data);
<p> <p>
Used to change configuration after initializing the multiselect. This may be useful in combination with <code>.multiselect('rebuild')</code>. Used to change configuration after initializing the multiselect. This may be useful in combination with <code>.multiselect('rebuild')</code>.
</p> </p>
</td>
</tr>
<tr>
<td>
<p><code>.multiselect('disable')</code></p>
<p>
Disable both the underlying select and the dropdown button.
</p>
</td>
<td>
<div class="btn-group">
<select id="example35" multiple="multiple">
<option value="cheese">Cheese</option>
<option value="tomatoes">Tomatoes</option>
<option value="mozarella">Mozzarella</option>
<option value="mushrooms">Mushrooms</option>
<option value="pepperoni">Pepperoni</option>
<option value="onions">Onions</option>
</select>
<button id="example35-disable" class="btn btn-default">Disable</button>
</div>
</td>
</tr>
<tr>
<td>
<p><code>.multiselect('enable')</code></p>
<p>
Enable both the underlying select and the dropdown button.
</p>
</td>
<td>
<div class="btn-group">
<select id="example36" multiple="multiple" disabled="disabled">
<option value="cheese">Cheese</option>
<option value="tomatoes">Tomatoes</option>
<option value="mozarella">Mozzarella</option>
<option value="mushrooms">Mushrooms</option>
<option value="pepperoni">Pepperoni</option>
<option value="onions">Onions</option>
</select>
<button id="example36-enable" class="btn btn-default">Enable</button>
</div>
</td> </td>
</tr> </tr>
</tbody> </tbody>
......
...@@ -136,11 +136,11 @@ ...@@ -136,11 +136,11 @@
this.$button = $(this.templates.button).addClass(this.options.buttonClass); this.$button = $(this.templates.button).addClass(this.options.buttonClass);
// Adopt active state. // Adopt active state.
if (this.$select.attr('disabled') == undefined) { if (this.$select.prop('disabled')) {
this.$button.removeClass('disabled'); this.disable();
} }
else { else {
this.$button.addClass('disabled'); this.enable();
} }
// Manually add button width if set. // Manually add button width if set.
...@@ -558,6 +558,20 @@ ...@@ -558,6 +558,20 @@
this.rebuild(); this.rebuild();
}, },
// Enable button.
enable: function() {
this.$select.prop('disabled', false);
this.$button.prop('disabled', false)
.removeClass('disabled');
},
// Disable button.
disable: function() {
this.$select.prop('disabled', true);
this.$button.prop('disabled', true)
.addClass('disabled');
},
// Set options. // Set options.
setOptions: function(options) { setOptions: function(options) {
this.options = this.mergeOptions(options); this.options = this.mergeOptions(options);
......
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