Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Problem with this version of DropDownLists, there is no removeItem function

Avatar

Former Community Member
Dear All,



I have a problem with this new version of the DropDownLists, in previous versions you had the removeItem function and others, but now you just have clearItems and addItem.



I have a list of elements in which a customer will be able to link and delete any element that he wants, I had selected a DropDownList to do that but considering that the removeItem function is not present I dont know how to do that...



Does anybody know how to delete a element in a dropdownlist?



If not, the solution will be to get all the elements in an array and reload the list but without the element "deleted" . Does anybody knows how to get all the elements of a DropDownList?



Thanks

Ruben.
1 Reply

Avatar

Former Community Member
If you have a drop-down list named myDropDownList,with SOMExpression


Form.page1.myDropDownList then you can remove the

element at position
i using the following code:



var myItems = xfa.form.resolveNode("Form.page1.myDropDownList.#items");

myItems.nodes.remove(myItems.nodes.item(i));



Good luck.