? ? ? Success

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
4 Jun 2014

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:

  • Changing the list, groupedlist, accesslevel and componentlayout formfields so it defaults to the class "advancedSelect" if no class is given. Currently there is no default at all.
  • Changing the list formfield so it removes this class if there are more than 10'000 options.
  • Changing the call JHtml::_('formbehavior.chosen', 'select'); to use the default JHtml::_('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 :smile:

Testing

  • Make sure the menu item edit screen looks the same before and after the patch. Especially the dropdown lists should look and behave the same (using Chosen).
  • Try testing with some big data, like 10'000 categories and check that the category selection doesn't use chosen anymore.
avatar Bakual Bakual - open - 4 Jun 2014
avatar Bakual Bakual - change - 4 Jun 2014
Title
Changing list formfields to use a default class "advancedSelect" for Chosen support
[#31514] Changing list formfields to use a default class "advancedSelect" for Chosen support
avatar brianteeman brianteeman - change - 8 Aug 2014
Labels Added: ?
avatar nicksavov nicksavov - change - 21 Aug 2014
Labels Removed: ?
avatar brianteeman brianteeman - change - 21 Aug 2014
Status New Pending
avatar brianteeman brianteeman - change - 21 Aug 2014
The description was changed
avatar brianteeman brianteeman - change - 2 Sep 2014
Category JavaScript
avatar prices
prices - comment - 14 Sep 2014

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.

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar n9iels
n9iels - comment - 28 Feb 2015

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.
avatar n9iels n9iels - test_item - 28 Feb 2015 - Not tested
avatar brianteeman
brianteeman - comment - 28 Feb 2015

You can use com_overload from @nikosdion
https://github.com/nikosdion/com_overload
On 28 Feb 2015 12:42, "Niels van der Veer" notifications@github.com wrote:

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
https://github.com/joomla/jissues at issues.joomla.org/joomla-cms/3721
http://issues.joomla.org/tracker/joomla-cms/3721.


Reply to this email directly or view it on GitHub
#3721 (comment).

avatar Bakual Bakual - close - 4 Nov 2015
avatar Bakual
Bakual - comment - 4 Nov 2015

Closing due to lack of interest.

avatar Bakual Bakual - change - 4 Nov 2015
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2015-11-04 08:53:14
Closed_By Bakual
avatar Bakual Bakual - close - 4 Nov 2015
avatar Bakual Bakual - head_ref_deleted - 4 Nov 2015
avatar joomla-cms-bot joomla-cms-bot - change - 4 Nov 2015
Labels Added: ?
avatar brianteeman
brianteeman - comment - 13 Apr 2016

Any chance of resurrecting this

avatar Bakual
Bakual - comment - 13 Apr 2016

If there is any interest in it, I (or anyone else) can recreate it easily.

avatar brianteeman
brianteeman - comment - 13 Apr 2016

If its easy to recreate I am definitely interested in seeing it

On 13 April 2016 at 18:09, Thomas Hunziker notifications@github.com wrote:

If there is any interest in it, I (or anyone else) can recreate it easily.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#3721 (comment)

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar Bakual Bakual - head_ref_restored - 13 Apr 2016
avatar Bakual
Bakual - comment - 13 Apr 2016

@brianteeman See #9901 (waiting for Travis to fail, need likely to fix some Unit Tests).

avatar Bakual Bakual - head_ref_deleted - 13 Apr 2016
avatar brianteeman
brianteeman - comment - 13 Apr 2016

Thanks - i will take a look tomorrow when I sober up

On 13 April 2016 at 18:47, Thomas Hunziker notifications@github.com wrote:

@brianteeman https://github.com/brianteeman See #9901
#9901 (waiting for Travis to
fail, need likely to fix some Unit Tests).


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#3721 (comment)

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar xjdfhbv
xjdfhbv - comment - 11 Jul 2016

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.

Add a Comment

Login with GitHub to post a comment