Created
May 3, 2015 09:49
-
-
Save yehudah/47fe3d28b3d2614e6aa8 to your computer and use it in GitHub Desktop.
fix select2 plugin inside jquery ui dialog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dialog = $( "#dialog-form" ).dialog({ | |
| autoOpen: true, | |
| height: 300, | |
| width: 450, | |
| modal: true, | |
| open: function () { | |
| if ($.ui && $.ui.dialog && $.ui.dialog.prototype._allowInteraction) { | |
| var ui_dialog_interaction = $.ui.dialog.prototype._allowInteraction; | |
| $.ui.dialog.prototype._allowInteraction = function(e) { | |
| if ($(e.target).closest('.select2-dropdown').length) return true; | |
| return ui_dialog_interaction.apply(this, arguments); | |
| }; | |
| } | |
| }, | |
| _allowInteraction: function (event) { | |
| return !!$(event.target).is(".select2-input") || this._super(event); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment