To reproduce the problem you have to edit a menu item, when modifying the main menu it performs an ajax correctly to modify options in the parent item. The problem is that it doesn't update via choices.
In form administrator\components\com_menus\forms\item.xml:
<field name="parent_id" type="MenuParent" label="COM_MENUS_ITEM_FIELD_PARENT_LABEL" layout="joomla.form.field.list-fancy-select" default="1" filter="int" clientid="0" > <option value="1">JGLOBAL_ROOT_PARENT</option> </field>
You have to modify the file media\com_menus\js\admin-item-edit.js
Return the corresponding menu items.
The selector does not update the options in Choices.
PHP Version 8.1.2
Joomla 4.2.2
I need to update selectors with Choices and haven't found any examples. With Chosen it was quite simple.
I have tried:
activeXHR = Joomla.request({ url, onSuccess: response => { activeXHR = null; const items = response ? JSON.parse(response) : [];
const ele = new Choices(document.getElementById('element')); if (items.length) { ele.setChoices(items, 'value', 'text', false); } }, onError: () => { activeXHR = null; } });
But it doesn't work for me and I don't think I have to re-instantiate it with: new Choices()
The instance is already created in file media\system\js\fields\joomla-field-fancy-select.js, so I don't know how to get an instance of a selector already created.
Can you help me please, thank you.
Labels |
Added:
No Code Attached Yet
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-01-17 21:35:35 |
Closed_By | ⇒ | richard67 |
Hi @wilsonge , @brianteeman
I have reported a joomla bug for quite some time and there is not even a response.
I understand that there is a lot to answer but the errors should be corrected as soon as possible for the correct functioning of joomla.
Thank you.