Commit b97ced0f authored by David Stutz's avatar David Stutz

#334 and #283.

parent 3a6b377c
...@@ -805,7 +805,7 @@ $(document).ready(function() { ...@@ -805,7 +805,7 @@ $(document).ready(function() {
<td><code>onDropdownShow</code></td> <td><code>onDropdownShow</code></td>
<td> <td>
<p> <p>
This event handler is triggered when the dropdown are shown. This event handler is triggered when the dropdown is shown.
</p> </p>
<p class="alert alert-warning"> <p class="alert alert-warning">
Both, the <code>onDropdownShow</code> and the <code>onDropdownHide</code> options are not supported when using Twitter Bootstrap 2.3.x. Both, the <code>onDropdownShow</code> and the <code>onDropdownHide</code> options are not supported when using Twitter Bootstrap 2.3.x.
...@@ -829,7 +829,7 @@ $(document).ready(function() { ...@@ -829,7 +829,7 @@ $(document).ready(function() {
<td><code>onDropdownHide</code></td> <td><code>onDropdownHide</code></td>
<td> <td>
<p> <p>
This event handler is triggered when the dropdown are hidden. This event handler is triggered when the dropdown is hidden.
</p> </p>
<p class="alert alert-warning"> <p class="alert alert-warning">
Both, the <code>onDropdownShow</code> and the <code>onDropdownHide</code> options are not supported when using Twitter Bootstrap 2.3.x. Both, the <code>onDropdownShow</code> and the <code>onDropdownHide</code> options are not supported when using Twitter Bootstrap 2.3.x.
...@@ -845,6 +845,54 @@ $(document).ready(function() { ...@@ -845,6 +845,54 @@ $(document).ready(function() {
} }
}); });
}); });
&lt;/script&gt;
</pre>
</td>
</tr>
<tr>
<td><code>onDropdownShown</code></td>
<td>
<p>
This event handler is triggered <i>after</i> the dropdown is shown.
</p>
<p class="alert alert-warning">
Both, the <code>onDropdownShown</code> and the <code>onDropdownHidden</code> options are not supported when using Twitter Bootstrap 2.3.x.
</p>
</td>
<td>
<pre class="prettyprint linenums">
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {
$(&#39;.multiselect&#39;).multiselect({
onDropdownShown: function(event) {
alert(&apos;Shown event invoked!&apos;);
}
});
});
&lt;/script&gt;
</pre>
</td>
</tr>
<tr>
<td><code>onDropdownHidden</code></td>
<td>
<p>
This event handler is triggered <i>after</i> the dropdown are hidden.
</p>
<p class="alert alert-warning">
Both, the <code>onDropdownShown</code> and the <code>onDropdownHidden</code> options are not supported when using Twitter Bootstrap 2.3.x.
</p>
</td>
<td>
<pre class="prettyprint linenums">
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {
$(&#39;.multiselect&#39;).multiselect({
onDropdownHidden: function(event) {
alert(&apos;Hidden event invoked!&apos;);
}
});
});
&lt;/script&gt; &lt;/script&gt;
</pre> </pre>
</td> </td>
...@@ -2366,6 +2414,13 @@ validator.settings.ignore = ':hidden:not(".multiselect")'; ...@@ -2366,6 +2414,13 @@ validator.settings.ignore = ':hidden:not(".multiselect")';
<p> <p>
This issue is mainly due to the default behavior of most browsers. A workaround can be found here: <a href="https://github.com/davidstutz/bootstrap-multiselect/issues/129">#129</a>. This issue is mainly due to the default behavior of most browsers. A workaround can be found here: <a href="https://github.com/davidstutz/bootstrap-multiselect/issues/129">#129</a>.
</p> </p>
<p>
<b>Which are the minimum required components of Twitter Botostrap to get the plugin working?</b>
</p>
<p>
The plugin needs at least the styles for forms and dropdowns. In addition the JavaScript dropdown plugin from Twitter Bootstrap is required. Details can be found here: <a href="https://github.com/davidstutz/bootstrap-multiselect/issues/344">#344</a>.
</p>
</div> </div>
<div class="container"> <div class="container">
......
...@@ -104,6 +104,8 @@ ...@@ -104,6 +104,8 @@
this.options.onChange = $.proxy(this.options.onChange, this); this.options.onChange = $.proxy(this.options.onChange, this);
this.options.onDropdownShow = $.proxy(this.options.onDropdownShow, this); this.options.onDropdownShow = $.proxy(this.options.onDropdownShow, this);
this.options.onDropdownHide = $.proxy(this.options.onDropdownHide, this); this.options.onDropdownHide = $.proxy(this.options.onDropdownHide, this);
this.options.onDropdownShown = $.proxy(this.options.onDropdownShown, this);
this.options.onDropdownHidden = $.proxy(this.options.onDropdownHidden, this);
// Build select all if enabled. // Build select all if enabled.
this.buildContainer(); this.buildContainer();
...@@ -201,6 +203,22 @@ ...@@ -201,6 +203,22 @@
*/ */
onDropdownHide: function(event) { onDropdownHide: function(event) {
},
/**
* Triggered after the dropdown is shown.
*
* @param {jQuery} event
*/
onDropdownShown: function(event) {
},
/**
* Triggered after the dropdown is hidden.
*
* @param {jQuery} event
*/
onDropdownHidden: function(event) {
}, },
buttonClass: 'btn btn-default', buttonClass: 'btn btn-default',
dropRight: false, dropRight: false,
...@@ -243,6 +261,8 @@ ...@@ -243,6 +261,8 @@
this.$container = $(this.options.buttonContainer); this.$container = $(this.options.buttonContainer);
this.$container.on('show.bs.dropdown', this.options.onDropdownShow); this.$container.on('show.bs.dropdown', this.options.onDropdownShow);
this.$container.on('hide.bs.dropdown', this.options.onDropdownHide); this.$container.on('hide.bs.dropdown', this.options.onDropdownHide);
this.$container.on('shown.bs.dropdown', this.options.onDropdownShown);
this.$container.on('hidden.bs.dropdown', this.options.onDropdownHidden);
}, },
/** /**
......
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