Skip to content

Commit cb71427

Browse files
fatmaakaywilsonge
authored andcommitted
[4.0] Fixed the parent item dropdown (#21348)
* Fixed the parent item dropdown * fixed code style
1 parent 6af97fd commit cb71427

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

build/media/com_menus/js/admin-item-edit.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,21 @@
4747
var data = JSON.parse(response);
4848
var list = document.querySelectorAll('#jform_parent_id option');
4949
list.forEach(function (item) {
50-
if (item != '1') {
50+
if (item.value !== '1') {
5151
item.remove();
5252
}
5353
});
5454

5555
data.forEach(function (val) {
5656
var option = document.createElement('option');
57-
option.innerText = value;
57+
option.innerText = val.title;
5858
option.id = val.id;
5959
document.getElementById('jform_parent_id').appendChild(option);
6060
});
61-
document.getElementById('jform_parent_id').trigger('change');
61+
62+
var event = document.createEvent('HTMLEvents');
63+
event.initEvent('change', true, false);
64+
document.getElementById('jform_parent_id').dispatchEvent(event);
6265
},
6366
onError : function (xhr) {
6467
Joomla.renderMessages(Joomla.ajaxErrorsMessages(xhr));

0 commit comments

Comments
 (0)