Skip to content
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

[4.2.2] Selector parent element 'parent_id' in edit menu does not perform update on selector choices #38792

Closed
JoomBall opened this issue Sep 21, 2022 · 4 comments

Comments

@JoomBall
Copy link

JoomBall commented Sep 21, 2022

Steps to reproduce the issue

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

PARENTID

Expected result

Return the corresponding menu items.

Actual result

The selector does not update the options in Choices.

System information (as much as possible)

PHP Version 8.1.2
Joomla 4.2.2

Additional comments

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.

@JoomBall
Copy link
Author

JoomBall commented Jan 7, 2023

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.

@brianteeman
Copy link
Contributor

@SniperSister
Copy link
Contributor

See #39659

@richard67
Copy link
Member

Closing as having a pull request. Please test #39659 . Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants