Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select2 broken width JqueryUI #1395

Closed
michelreyes opened this issue Jun 6, 2013 · 4 comments
Closed

Select2 broken width JqueryUI #1395

michelreyes opened this issue Jun 6, 2013 · 4 comments

Comments

@michelreyes
Copy link

hello,
i use select2 (i test all version, since 2.2 until master)
i use jquery 1.9.1 (with and without migrate)
i use jqueryui lastest version

When i put a select2 on a jqueryui dialog and dropdown de select2 to search some option the input for search lose control (focus). I test , and test and retest in diferents new projects but always is the same result.

can you please help me?

sorry my english :{

@michelreyes
Copy link
Author

I recentely read Issue #940 and use the solution posted there:
$("select").select2( { dropdownCssClass: 'ui-dialog' } );

if any other solution , please share it
thanks!

@michelreyes
Copy link
Author

i also see the following solution:

$.ui.dialog.prototype._allowInteraction = function(e) {
return !!$(e.target).closest('.ui-dialog, .ui-datepicker, .select2-drop').length;
};

And my question is: what will be the best solution?
the first: solution (post previosuly) must apply in every select2 call
the second one: must by apply just once.
...But what kind of implication have each in the DOM or in any project?

@ivaynberg
Copy link
Contributor

there is no "best". personally i prefer

$.ui.dialog.prototype._allowInteraction = function(e) {
    return !!$(e.target).closest('.ui-dialog, .ui-datepicker, .select2-drop').length;
};

@Ankush-Goyal
Copy link

Try editing the jquery.ui.js file.
Just add $(selector).select2() in the widget function open and inside it just after this._trigger("open").
Its a workaround but should help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants