Commit 3a0948ac authored by David Stutz's avatar David Stutz

Merge pull request #173 from rzcoder/master

Add support for show/hide events.
parents eb469cb2 368f2bf1
......@@ -665,6 +665,44 @@
</pre>
</td>
</tr>
<tr>
<td><code>onDropdownShow</code></td>
<td>
This event handler is triggered when the dropdown are shown.
</td>
<td>
<pre class="prettyprint linenums">
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {
$(&#39;.multiselect&#39;).multiselect({
onDropdownShow: function(event) {
alert(&apos;Show event invoked!&apos;);
}
});
});
&lt;/script&gt;
</pre>
</td>
</tr>
<tr>
<td><code>onDropdownHide</code></td>
<td>
This event handler is triggered when the dropdown are hidden.
</td>
<td>
<pre class="prettyprint linenums">
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {
$(&#39;.multiselect&#39;).multiselect({
onDropdownHide: function(event) {
alert(&apos;Hide event invoked!&apos;);
}
});
});
&lt;/script&gt;
</pre>
</td>
</tr>
<tr>
<td><code>maxHeight</code></td>
<td>
......
......@@ -39,6 +39,8 @@
this.options.multiple = this.$select.attr('multiple') == "multiple";
this.options.onChange = $.proxy(this.options.onChange, this);
this.options.onDropdownShow = $.proxy(this.options.onDropdownShow, this);
this.options.onDropdownHide = $.proxy(this.options.onDropdownHide, this);
// Build select all if enabled.
this.buildContainer();
......@@ -98,6 +100,14 @@
// Is triggered on change of the selected options.
onChange : function(option, checked) {
},
// Triggered immediately when dropdown shown
onDropdownShow: function(event) {
},
// Triggered immediately when dropdown hidden
onDropdownHide: function(event) {
},
buttonClass: 'btn',
dropRight: false,
......@@ -134,6 +144,8 @@
buildContainer: function() {
this.$container = $(this.options.buttonContainer);
this.$container.on('show.bs.dropdown', this.options.onDropdownShow);
this.$container.on('hide.bs.dropdown', this.options.onDropdownHide);
},
buildButton: function() {
......
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