It was supposed to be a simple task, following the dev tutorial to create a selection pop-up: https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/selecting-entities-using-the-item-selector
I followed this text, replacing the criterion by a JournalItemSelectorCriterion.
RequestBackedPortletURLFactory requestBackedPortletURLFactory = RequestBackedPortletURLFactoryUtil.create( request );
List< ItemSelectorReturnType > itemSelectorReturnTypes = new ArrayList<>( );
itemSelectorReturnTypes.add( new UUIDItemSelectorReturnType( ) );
JournalItemSelectorCriterion itemSelectorCriterion = new JournalItemSelectorCriterion( );
itemSelectorCriterion.setDesiredItemSelectorReturnTypes( itemSelectorReturnTypes );
return itemSelector.getItemSelectorURL( requestBackedPortletURLFactory, selectedEventName, itemSelectorCriterion );
The OSGi components are in order, otherwise I would get a null pointer exception.
When clicked, the button does open the dialog as expected, but without any entry, just a big:
Selection is not available.
There is only one message in the logs:
No item selector views found for com.liferay.journal.item.selector.criterion.JournalItemSelectorCriterion
$('#<portlet:namespace />selectJournal').on(
'click',
function(event) {
var itemSelectorDialog = new A.LiferayItemSelectorDialog(
{
eventName: 'selectWcToSend',
on: {
selectedItemChange: function(event) {
var selectedItem = event.newVal;
if (selectedItem) {
var itemValue = JSON.parse(
selectedItem.value
);
var wcUuid = itemValue.uuid;
$('#<portlet:namespace />uuid').val(wcUuid);
}
}
},
title: '<liferay-ui:message key="select-web-content" />',
url: "${journalSelectorUrl}"
}
);
itemSelectorDialog.open();
}
);
Any thoughts?
ps: using Liferay 7 GA5
ps2: same issue here: https://web.liferay.com/community/forums/-/message_boards/view_message/104166898
A bit odd: the code works when I change itemSelectorReturnTypes.add( new UUIDItemSelectorReturnType() );
to itemSelectorReturnTypes.add( new URLItemSelectorReturnType() );
Not much information out there about this, so I will leave here what I found: this specific criterion does not support UUID as the return type.
_supportedItemSelectorReturnTypes = Collections.unmodifiableList(
ListUtil.fromArray(
new ItemSelectorReturnType[] {
new FileEntryItemSelectorReturnType(),
new URLItemSelectorReturnType()
}));