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

failing to paste when filling the select dynamically #1959

Closed
patricknn opened this issue Jun 2, 2014 · 3 comments
Closed

failing to paste when filling the select dynamically #1959

patricknn opened this issue Jun 2, 2014 · 3 comments

Comments

@patricknn
Copy link

I have a very big table with a bunch of selects
These selects are huge with more than 150 options, so, to avoid my browser to freeze I fill these selects dynamically.

The Idea is fill these selects when the chosen:showing_dropdown event is fired

The issue is that when I go from one select to another using the tab key, I try to paste my clipboard content directly and I need to paste twice in order to paste my content inside the input.

The first paste command(CTRL+V) only open the dropdown, the input keeps empty.

If I remove my dynamically filling, this issue does not happen anymore

Here it is a bug reproduction.

http://jsfiddle.net/fzGLA/

Is there any way to avoid this behavior or it is a bug?

Thanks

@pfiller
Copy link
Contributor

pfiller commented Jun 4, 2016

When chosen:updated is triggered, Chosen goes through the entire process of rebuilding itself. One of the steps that gets taken is calling show_search_field_default which empties out the search field. So your paste is working, but is getting cleared right away.

I would point out that browsers are more than capable of handling selects with 150 options in them. No need to get all fancy trying to delay their construction!

@pfiller pfiller closed this as completed Jun 4, 2016
@patricknn
Copy link
Author

patricknn commented Jun 6, 2016

Yeah, about the browser: the problem is that my screen does not have 1 or 2 selects, I have more than 100-200-300, thats why I delay the construction filling dynamically, because if I do not do that my browser freezes and it does not matter how much system memory I have :(

@pfiller
Copy link
Contributor

pfiller commented Jun 6, 2016

Ah. You could try building when the Chosen element gets focus (maybe listen on the chosen-single class) instead of when the dropdown is showing. Beyond that, I might actually start working within the Chosen source directly instead of bolting functionality on.

Sorry I'm not more 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

2 participants