{"action":"created","issue":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/9901","repository_url":"https://api.github.com/repos/joomla/joomla-cms","labels_url":"https://api.github.com/repos/joomla/joomla-cms/issues/9901/labels{/name}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/9901/comments","events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/9901/events","html_url":"https://github.com/joomla/joomla-cms/pull/9901","id":148133599,"number":9901,"title":"Changing list formfields to use a default class \"advancedSelect\" for Chosen support","user":{"login":"Bakual","id":1018684,"avatar_url":"https://avatars.githubusercontent.com/u/1018684?v=3","gravatar_id":"","url":"https://api.github.com/users/Bakual","html_url":"https://github.com/Bakual","followers_url":"https://api.github.com/users/Bakual/followers","following_url":"https://api.github.com/users/Bakual/following{/other_user}","gists_url":"https://api.github.com/users/Bakual/gists{/gist_id}","starred_url":"https://api.github.com/users/Bakual/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bakual/subscriptions","organizations_url":"https://api.github.com/users/Bakual/orgs","repos_url":"https://api.github.com/users/Bakual/repos","events_url":"https://api.github.com/users/Bakual/events{/privacy}","received_events_url":"https://api.github.com/users/Bakual/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/joomla/joomla-cms/labels/PR-staging","name":"PR-staging","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-13T17:46:58Z","updated_at":"2016-04-13T22:06:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/9901","html_url":"https://github.com/joomla/joomla-cms/pull/9901","diff_url":"https://github.com/joomla/joomla-cms/pull/9901.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/9901.patch"},"body":"This is an updated and bit improved version of #3721.\r\nOriginally it started as a way to automatically disable Chosen when there are a lot of options. It expanded a bit from there.\r\n\r\n### Issue\r\nChosen 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.\r\nThis PR makes use of the default behaviour of `JHtml::_('formbehavior.chosen');` which triggers on the class `.advancedSelect`.\r\n\r\n### Proposed Solution\r\nThis PR will do a few things:\r\n- 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.\r\n- Changing the `list` formfield so it removes this class if there are more than 10'000 options.\r\n- Changing the call `JHtml::_('formbehavior.chosen', 'select');` to use the default `JHtml::_('formbehavior.chosen');` in the menu item view.\r\n\r\nFor 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.\r\n\r\nIf 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.\r\n\r\nThere may be better ideas of course :smile: \r\n\r\n### Testing\r\n* 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).\r\n* Try testing with some big data, like 10'000 categories and check that the category selection doesn't use chosen anymore."},"comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments/209667906","html_url":"https://github.com/joomla/joomla-cms/pull/9901#issuecomment-209667906","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/9901","id":209667906,"user":{"login":"brianteeman","id":1296369,"avatar_url":"https://avatars.githubusercontent.com/u/1296369?v=3","gravatar_id":"","url":"https://api.github.com/users/brianteeman","html_url":"https://github.com/brianteeman","followers_url":"https://api.github.com/users/brianteeman/followers","following_url":"https://api.github.com/users/brianteeman/following{/other_user}","gists_url":"https://api.github.com/users/brianteeman/gists{/gist_id}","starred_url":"https://api.github.com/users/brianteeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianteeman/subscriptions","organizations_url":"https://api.github.com/users/brianteeman/orgs","repos_url":"https://api.github.com/users/brianteeman/repos","events_url":"https://api.github.com/users/brianteeman/events{/privacy}","received_events_url":"https://api.github.com/users/brianteeman/received_events","type":"User","site_admin":false},"created_at":"2016-04-13T22:06:58Z","updated_at":"2016-04-13T22:06:58Z","body":"Before I dig into the code - is 10,000 a limit you have set in the code or\nwas it an example?\n\nOn 13 April 2016 at 18:47, Thomas Hunziker <notifications@github.com> wrote:\n\n> This is an updated and bit improved version of #3721\n> <https://github.com/joomla/joomla-cms/pull/3721>.\n> Originally it started as a way to automatically disable Chosen when there\n> are a lot of options. It expanded a bit from there.\n> Issue\n>\n> Chosen has performance issues when facing a huge amount of options. Since\n> the menu item view (like most views) use JHtml::_('formbehavior.chosen',\n> 'select'); to load Chosen on every <select>, this can break the creation\n> of menu items.\n> This PR makes use of the default behaviour of\n> JHtml::_('formbehavior.chosen'); which triggers on the class\n> .advancedSelect.\n> Proposed Solution\n>\n> This PR will do a few things:\n>\n>    - Changing the list, groupedlist, accesslevel and componentlayout\n>    formfields so it defaults to the class \"advancedSelect\" if no class is\n>    given. Currently there is no default at all.\n>    - Changing the list formfield so it removes this class if there are\n>    more than 10'000 options.\n>    - Changing the call JHtml::_('formbehavior.chosen', 'select'); to use\n>    the default JHtml::_('formbehavior.chosen'); in the menu item view.\n>\n> For now, the scope is only the menu item edit form, however it would be\n> possible to expand it to other places as well if we decide to follow that\n> route. Especially if we use a default class within the fields, we don't\n> have to edit 100+ XML files to add the class there.\n>\n> If a developer decides he doesn't want to use Chosen for a specific field,\n> he could just add a random class to the field in the XML and Chosen\n> wouldn't be loaded anymore.\n>\n> There may be better ideas of course [image: :smile:]\n> Testing\n>\n>    - Make sure the menu item edit screen looks the same before and after\n>    the patch. Especially the dropdown lists should look and behave the same\n>    (using Chosen).\n>    - Try testing with some big data, like 10'000 categories and check\n>    that the category selection doesn't use chosen anymore.\n>\n> ------------------------------\n> You can view, comment on, or merge this pull request online at:\n>\n>   https://github.com/joomla/joomla-cms/pull/9901\n> Commit Summary\n>\n>    - Changing list formfields to use a default class \"advancedSelect\" for\n>    Chosen support\n>\n> File Changes\n>\n>    - *M* administrator/components/com_menus/models/forms/item.xml\n>    <https://github.com/joomla/joomla-cms/pull/9901/files#diff-0> (2)\n>    - *M* administrator/components/com_menus/models/item.php\n>    <https://github.com/joomla/joomla-cms/pull/9901/files#diff-1> (1)\n>    - *M* administrator/components/com_menus/views/item/tmpl/edit.php\n>    <https://github.com/joomla/joomla-cms/pull/9901/files#diff-2> (2)\n>    - *M* libraries/joomla/form/fields/accesslevel.php\n>    <https://github.com/joomla/joomla-cms/pull/9901/files#diff-3> (8)\n>    - *M* libraries/joomla/form/fields/groupedlist.php\n>    <https://github.com/joomla/joomla-cms/pull/9901/files#diff-4> (8)\n>    - *M* libraries/joomla/form/fields/list.php\n>    <https://github.com/joomla/joomla-cms/pull/9901/files#diff-5> (27)\n>    - *M* libraries/legacy/form/field/componentlayout.php\n>    <https://github.com/joomla/joomla-cms/pull/9901/files#diff-6> (8)\n>\n> Patch Links:\n>\n>    - https://github.com/joomla/joomla-cms/pull/9901.patch\n>    - https://github.com/joomla/joomla-cms/pull/9901.diff\n>\n> —\n> You are receiving this because you are subscribed to this thread.\n> Reply to this email directly or view it on GitHub\n> <https://github.com/joomla/joomla-cms/pull/9901>\n>\n\n\n\n-- \nBrian Teeman\nCo-founder Joomla! and OpenSourceMatters Inc.\nhttp://brian.teeman.net/\n"}}