? Pending

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
13 Apr 2016

This is an updated and bit improved version of #3721.
Originally it started as a way to automatically disable Chosen when there are a lot of options. It expanded a bit from there.

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 <select>, 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 ?

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 - 13 Apr 2016
avatar Bakual Bakual - change - 13 Apr 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 13 Apr 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 13 Apr 2016
Category Fields
avatar brianteeman
brianteeman - comment - 13 Apr 2016

Before I dig into the code - is 10,000 a limit you have set in the code or
was it an example?

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

This is an updated and bit improved version of #3721
#3721.
Originally it started as a way to automatically disable Chosen when there
are a lot of options. It expanded a bit from there.
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 [image: :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. You can view, comment on, or merge this pull request online at: https://github.com/joomla/joomla-cms/pull/9901 Commit Summary Changing list formfields to use a default class "advancedSelect" for Chosen support File Changes M administrator/components/com_menus/models/forms/item.xml https://github.com/joomla/joomla-cms/pull/9901/files#diff-0 (2) M administrator/components/com_menus/models/item.php https://github.com/joomla/joomla-cms/pull/9901/files#diff-1 (1) M administrator/components/com_menus/views/item/tmpl/edit.php https://github.com/joomla/joomla-cms/pull/9901/files#diff-2 (2) M libraries/joomla/form/fields/accesslevel.php https://github.com/joomla/joomla-cms/pull/9901/files#diff-3 (8) M libraries/joomla/form/fields/groupedlist.php https://github.com/joomla/joomla-cms/pull/9901/files#diff-4 (8) M libraries/joomla/form/fields/list.php https://github.com/joomla/joomla-cms/pull/9901/files#diff-5 (27) M libraries/legacy/form/field/componentlayout.php https://github.com/joomla/joomla-cms/pull/9901/files#diff-6 (8) Patch Links: https://github.com/joomla/joomla-cms/pull/9901.patch https://github.com/joomla/joomla-cms/pull/9901.diff — You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/joomla/joomla-cms/pull/9901 Brian Teeman Co-founder Joomla! and OpenSourceMatters Inc. http://brian.teeman.net/

avatar Bakual
Bakual - comment - 14 Apr 2016

It's a hardcoded limit. I would have to read through the comments of all previous PRs to see how I got to that number. I honestly don't remember anymore but apparently someone had such insane numbers of categories.
If the performance issues start with fewer numbers already, we can make that number lower for sure.

avatar Grigory90
Grigory90 - comment - 22 May 2016

This branch will be merged?
I would like to customize in their extensions, but "Chosen" does not give ...

avatar Bakual
Bakual - comment - 22 May 2016

@Grigory90 Without user tests, nothing will get merged.

avatar Grigory90
Grigory90 - comment - 22 May 2016

@Bakual Oops, I think is not correctly understood the purpose of this PR. I need to "Chosen" was not call on the module edit page.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 6 Jan 2017

@Bakual do i understand correct: More than 10.000 Categories, in "Menu: Edit Item" test if "Select a Category" works before and after Patch same?

avatar Bakual
Bakual - comment - 6 Jan 2017

Chosen should be disabled for lists (eg the category list) with more than those 10'000 entries. So there should be a difference in appearance.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 7 Jan 2017

I have tested this item ? unsuccessfully on 4016f63

"Menu: Edit Item" looks same with and without Patch, "Select a Category" is visible with more than 10.000 entries.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/9901.

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 7 Jan 2017 - Tested unsuccessfully
avatar Bakual
Bakual - comment - 7 Jan 2017

Honestly IU haven't looked at this one in ages. Looks like the category select was changed to not being a chosen list anymore. Then this PR has no effect anymore.

I'm closing it for now. It didn't get much interest anyway.

avatar Bakual Bakual - change - 7 Jan 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-01-07 13:49:56
Closed_By Bakual
avatar Bakual Bakual - close - 7 Jan 2017
avatar joomla-cms-bot joomla-cms-bot - change - 7 Jan 2017
Category Fields Administration com_menus Libraries Fields

Add a Comment

Login with GitHub to post a comment