-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[4.0] Set proper limits for joomla-fancy-select layout #30836
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
Issue: #30288 More commits comin soon
|
Please fix coding style: https://ci.joomla.org/joomla/joomla-cms/35972/1/8 |
Co-authored-by: Quy <[email protected]>
|
@Quy I don't know how to validate that issue, it might be unrelated. |
|
I tested, 20ms improvement in loading time. but when I save the module settings it doesn't save the item when set to blank. and list still shows all items |
|
I have tested this item 🔴 unsuccessfully on b857e0d This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30836. |
it might be unrelated, but to be sure I will test this as soon as I get some time. Thanks |
|
@mqueme I tested the I believe this is a non-issue. Anyone else have an opinion on this? |
it is correct behavior of |
|
That behavior is expected especially if you want your form field to force the end used to use a value. For instance SCSS mixins/styles cannot work with blank values, In other cases you can work with blank values for your form fields, you can simply add a new It's up to the developer to decide on his/her extension how the form field of |
|
Do you guys think we need to implement choices.js I'm also thinking of a way to check the first CHOICE and set this instance option automatically based on the value. (NULL => true, notNULL => false), what do you guys think? |
|
I think it should accept null values, the current option has an x to remove the selected value which implies clearing the field. But saving it put the value back which makes it very confusing. |
|
@mqueme that is why I proposed in my previous post implementation of |
|
I not very like that idea. choices.js mimic behavior of |
|
@Fedik understood. However setting proper limits is pretty important as explained above. |
|
Why didn't you say so? Should I follow up on @HLeithner commit? it seems logical to me. |
|
@Fedik make |
|
This PR is obsolete. Will commit a new one soon. |
PR for Issue #30288
Summary of Changes
As explained with the issue at hand, the choices.js provides support for a render limit of the options and a search results limit, the first is much more important.
build/media_source/system/js/fields/joomla-field-fancy-select.w-c.es6.jsnow can userender-limitandresults-limitattributes to setsearchResultLimitandrenderChoiceLimitoptions for choices.js;libraries/src/Form/Field/ListField.phpnow can properly add therenderLimitandresultsLimitattributes from layout;layouts/joomla/form/field/list-fancy-select.phpcan now add therender-limitandresults-limitHTML attributes to the element from the layout setrenderLimitandresultsLimitfield properties.Alternative solution
Since the issue we're trying to solve is the slow initialization for large lists, we can simply replace
searchResultLimitwithrenderChoiceLimitwith the same value of 10 inbuild/media_source/system/js/fields/joomla-field-fancy-select.w-c.es6.js. The user would expect a search to take some time, but an initialization cannot take 2-3 seconds per field. This however won't give developers much flexibility.Testing Instructions
extensionName.xmland add this field in any<fieldset>Actual result BEFORE applying this Pull Request
Large lists are initialized extremely slow, also the initial
resultsLimitof 10 was not enough. Imagine more than 10 Roboto font family styles, or much more articles that contain a certain keyword / combination of keywords.Expected result AFTER applying this Pull Request
Much faster initialization, also more flexible PHP extend possibilities.
Documentation Changes Required
Yes.