-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[#31514] Changing list formfields to use a default class "advancedSelect" for Chosen support #3721
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
Conversation
…here are more than 10'000 options since Chosen has performance issues with so many options.
… the list formfield.
…s "advancedSelect" instead on all selects. This is the default behaviour for this function.
…en is explicitely allowed on this elements.
I am working on a user plugin where I am running into similar problems. I have a custom form field that has two multiple select fields and buttons to move things between them. The formbehavior.chosen multiple select boxes kind of kill the point of doing that, because you can't see what is in either of the fields unless you click on them. What I ended up doing in the component that goes with the plugin is using JHtml::_('formbehavior.chosen', 'select:not(.plain)'); which defaults to all of them, unless I use the class 'plain' on the fields. In this way, I can easily make the default to use the chosen behavior, but choose not to use it, if I don't want it. I would like to see something like this in com_users, so my dual select boxes look reasonable again. I am posting this here because the original poster is suggesting doing his change all over Joomla. If you want, I can post a new bug. |
Can you please give us an method to make 10000 categories so we can test your patch? This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/3721. |
You can use com_overload from @nikosdion
|
Closing due to lack of interest. |
Any chance of resurrecting this |
If there is any interest in it, I (or anyone else) can recreate it easily. |
If its easy to recreate I am definitely interested in seeing it On 13 April 2016 at 18:09, Thomas Hunziker [email protected] wrote:
Brian Teeman |
@brianteeman See #9901 (waiting for Travis to fail, need likely to fix some Unit Tests). |
Thanks - i will take a look tomorrow when I sober up On 13 April 2016 at 18:47, Thomas Hunziker [email protected] wrote:
Brian Teeman |
There absolutely needs to be a way for select lists to "opt out" of being modified by Chosen. There will always be occasions where Chosen either doesn't work well, or isn't appropriate. I have just had to add some Javascript to one of my extensions to prevent a select list being hit by Chosen, but it's not pretty. The Chosen initialisation should be modified to always exclude selects that have a certain class, e.g. "not_chosen", or something. |
This is an updated and bit improved version of #1620.
Originally it started as a way to automatically disable Chosen when there are a lot of options. It expanded a bit from there.
There are also other PRs with have different ways proposed to solve similar issues: #2018, #1609
See also Feature Tracker:
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=31514
Issue
Chosen has performance issues when facing a huge amount of options. Since the menu item view (like most views) use
JHtml::_('formbehavior.chosen', 'select');
to load Chosen on every ``, this can break the creation of menu items.This PR makes use of the default behaviour of
JHtml::_('formbehavior.chosen');
which triggers on the class`.advancedSelect`.Proposed Solution
This PR will do a few things:
list
,groupedlist
,accesslevel
andcomponentlayout
formfields so it defaults to the class "advancedSelect" if no class is given. Currently there is no default at all.list
formfield so it removes this class if there are more than 10'000 options.JHtml::_('formbehavior.chosen', 'select');
to use the defaultJHtml::_('formbehavior.chosen');
in the menu item view.For now, the scope is only the menu item edit form, however it would be possible to expand it to other places as well if we decide to follow that route. Especially if we use a default class within the fields, we don't have to edit 100+ XML files to add the class there.
If a developer decides he doesn't want to use Chosen for a specific field, he could just add a random class to the field in the XML and Chosen wouldn't be loaded anymore.
There may be better ideas of course 😄
Testing