Is there an alternative to the 'Liferay.Util.selectEntity' function?
How To articles are not official guidelines or officially
supporteddocumentation. They are community-contributed content and may
not alwaysreflect the latest updates to Liferay DXP. We welcome your
feedback toimprove How to articles!
While we make every effort to ensure this Knowledge Base is accurate,
itmay not always reflect the most recent updates or official
guidelines.We appreciate your understanding and encourage you to reach
out with anyfeedback or concerns.
Legacy Article
You are viewing an article from our legacy
"FastTrack"publication program, made available for
informational purposes. Articlesin this program were published without a
requirement for independentediting or verification and are provided
"as is" withoutguarantee.
Before using any information from this article, independently verify
itssuitability for your situation and project.
Issue
- After upgrading to 2024.Q2+,
Liferay.Util.selectEntity
does not work anymore. It has been removed, according to the 2024.Q2 Breaking Changes.
- Is there any replacement for it?
Resolution
- Although it has been removed as of 2024.Q2, the replacement was made a few years ago in LPS-112298 Update Liferay.Util.selectEntity utility, as part of the epic LPS-101984 Provide Modal Patterns matching Lexicon Definition, where you can find more information.
- Within the product, usages of
Liferay.Util.selectEntity
(AUI-based) were replaced by Liferay.Util.openModal
(Clay-based). You can find the changes in this pull request. For example (FragmentCompositionDropdownDefaultEventHandler.es.js
):
- Before
Liferay.Util.selectEntity(
{
dialog: {
constrain: true,
destroyOnHide: true,
modal: true,
},
eventName: this.ns('selectFragmentCollection'),
id: this.ns('selectFragmentCollection'),
title: Liferay.Language.get('select-collection'),
uri: selectFragmentCollectionURL,
},
(selectedItem) => {
if (selectedItem) {
...
}
}
);
- After
Liferay.Util.openModal({
id: this.ns('selectFragmentCollection'),
onSelect: (selectedItem) => {
if (selectedItem) {
...
}
},
selectEventName: this.ns('selectFragmentCollection'),
title: Liferay.Language.get('select-collection'),
url: selectFragmentCollectionURL,
});
Did this article resolve your issue ?