Senin, 16 Juli 2018

Jquery Select2 Plugin And Jquery UI Modal Dialogs

I am using the Select2 plugin, but the built in search functionality doesn't work when the plugin is used with a jQuery modal dialog.
There's a new version of the fix bigwavesoftware gives for select2 4.0 from the github issue thread about this problem:
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);
    };
}
This only needs to be run before any modal dialogs that will have select2 in them are created; you don't need to do anything special inside of the dialog options like in bigwavesoftware's solution.
#select2 #jquery #jqueryselect2 #modal #ui #dialog #dialogs
Share this post
  • Share to Facebook
  • Share to Twitter
  • Share to Google+
  • Share to Stumble Upon
  • Share to Evernote
  • Share to Blogger
  • Share to Email
  • Share to Yahoo Messenger
  • More...

0 komentar

:) :-) :)) =)) :( :-( :(( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ :-$ (b) (f) x-) (k) (h) (c) cheer

 
© Debug Me
Designed by PHP Warrior
Posts RSSComments RSS
Back to top