User tests: Successful: Unsuccessful:
If a list in the global configuration doesn't contain 10 items but it should support to add custom values, then it doesn't work. To fix that, the search thrashhold should be set to 0.
A side effect will be that every list will be searchable in the global configuration.
Add the following XML code o the file administrator/components/com_content/config.xml after line 6.
<field name="demo" type="list"
default="bs2" class="chzn-custom-value"
label="Demo">
<option value="bs2">BS2</option>
<option value="bs3">BS3</option>
</field>
There is a demo value in the article configuration. Additionally all lists should be searchable and saveable.
The following screencast shows a similar setup for DPCalendar.
On small lists it is not possible to add custom values.
The following screencast shows a similar setup for DPCalendar.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_config |
But then you have to tell me how can I do that for the global component options. Because in my setup function of my form field does the following code not change the desired behavior of my field
JHtml::_('formbehavior.chosen', '#jform_frontend_framework', null, array(
'disable_search_threshold' => 0
));
event adding the code to the form field constructor didn't help.
very strange
JHtml::_('formbehavior.chosen', '#jform_frontend_framework', null, array( 'disable_search_threshold' => 0 ));
looks correct,
ah, well, the problem that JHtml::_('formbehavior.chosen', 'select');
I guess called on front of your, hard,
another
There is no way to add it from the form field, you will always be after the general select call.
Yep, that's true. It would need to be before the stupid global call.
What we can do is add a call to chosen with a class selector, like a class "nosearchlimit" or something. And then you just add that class to you formfield and it will work.
@laoneo I think your only way out of this is by creating a custom field (inception) like https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_categories/models/fields/categoryedit.php
It would be so much easier to set the trashhold back to 0. Is there a valid reason not to do? Otherwise every extension dev has always to come to this pr and needs to do the workaround suggested here.
@dgt41 I did that and tried to add a new choosen behavior. The problem is that the categoryedit field is loaded in a category view which loads the chosen behavior with a 0 thrashold https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/views/article/tmpl/edit.php#L17 . If this call would be 10 and you have less than 10 categories. It would also not work.
I think for com_config it would be valid to load it with 0 thrashold as every installed component is involved here.
It would be so much easier to set the trashhold back to 0. Is there a valid reason not to do?
Yes, because it is ridiculous to have a search field for eg the state or permission list fields. Also it was inconsistent accross the various forms.
I proposed you already a working solution, which then could also applied to the category field cases. Lets go with that instead of adding a search box to every list field.
Can someone clarify the status of this PR please
I proposed you already a working solution
Haven't seen one which was working. So the issue still exists as an extension dev can't add a form field which supports new options.
Haven't seen one which was working.
My suggestion was instead of your change, do this:
JHtml::_('formbehavior.chosen', '.search-always', null, array('disable_search_threshold' => 0));
JHtml::_('formbehavior.chosen', 'select');
Then add search-always
as class in your formfield.
That should work. We just need to settle on a sensible class name.
But then I would rather go with
JHtml::_('formbehavior.chosen', '.chzn-custom-value', null, array('disable_search_threshold' => 0));
JHtml::_('formbehavior.chosen', 'select');
as chzn-custom-value is the class you need to add when you want to have custom values.
Yeah sure, makes most sense then
Done.
Yes it is
I have tested this item
After PR installed and modefied *.xml theres a searchable list on Articles > Tab Articles
called "demo".
After installing PR got Notice: Undefined offset: 1 in __/Joomla/libraries/joomla/form/helper.php on line 363
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
Setting to RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-02-13 20:32:44 |
Closed_By | ⇒ | rdeutz | |
Labels |
Added:
?
|
Yeah, we just reverted that code lately because we don't want the searchfield for all fields.
See #12855
If you need it for a specific field, load chosen again with different arguments for that selector alone.