-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Limit number of tags returned in Ajax calls #13277
Conversation
layouts/joomla/html/tag.php
Outdated
// Tag deselected so remove it from the internal list. | ||
if (params.hasOwnProperty('deselected')) | ||
{ | ||
var index = tagList.indexOf(parseInt(params.deselected)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrisdavenport indexOf is not compatible with IE8: http://stackoverflow.com/questions/3629183/why-doesnt-indexof-work-on-an-array-ie8
Use the polyfill from the link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I'm not a JS programmer, so I wasn't aware of that.
I have tested this item 🔴 unsuccessfully on 5adfe42 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13277. |
@franz-wohlkoenig Thanks for testing. Was the dropdown empty before you applied the PR? Can you look in developer tools and see if the Ajax is throwing any errors? What version of Joomla did you test with? What database are you using? Any errors logged? |
Was the dropdown empty before you applied the PR?
Can you look in developer tools and see if the Ajax is throwing any errors?
What version of Joomla did you test with?
What database are you using?
Any errors logged?
|
I have tested this item 🔴 unsuccessfully on 5adfe42 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13277. |
Hello, I am sorry This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13277. |
I am closing this as it has not been successfully tested and there has been no comment from the OP It can always be re-opened if fixed |
Pull Request for Issue #8074 and a replacement for PR #9155.
Summary of Changes
Finally got some time to look at this again. Although it's relatively straightforward to limit the number of tags initially shown in the drop-down (which was a problem for sites with thousands of tags), the list needs to be updated as tags are selected.
The problem is that if you select one or more tags from the list, then deselect them again (without clicking Save), the drop-down list is dramatically shortened to just those tags that have been added or removed since the page was loaded. The only way to load and select further tags is to start entering characters so that the search function kicks in.
With this PR, whenever a tag is selected an Ajax call is made so that tags are continually added to the drop-down list to replenish it.
In the process of writing this code I also made the JHelperTags::searchTags method a little smarter so that a considerable amount of duplicated code has been removed from JFormFieldTag::getOptions.
Testing Instructions
Documentation Changes Required
None.