这应该是一个简单的任务,按照开发教程创建选择弹出窗口:https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/selecting-entities-using-the-item-selector
我遵循了这个文本,用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 );
OSGi组件是有序的,否则我会得到一个空指针异常。
单击时,按钮会按预期打开对话框,但没有任何输入,只需要一个大的:
无法选择。
日志中只有一条消息:
找不到项目选择器视图 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();
}
);
有什么想法吗?
ps:使用Liferay 7 GA5
ps2:同样的问题:https://web.liferay.com/community/forums/-/message_boards/view_message/104166898
有点奇怪:当我将itemSelectorReturnTypes.add( new UUIDItemSelectorReturnType() );
更改为itemSelectorReturnTypes.add( new URLItemSelectorReturnType() );
答案 0 :(得分:0)
关于此的信息不多,所以我将离开这里找到的内容:这个特定的标准不支持UUID作为返回类型。
_supportedItemSelectorReturnTypes = Collections.unmodifiableList(
ListUtil.fromArray(
new ItemSelectorReturnType[] {
new FileEntryItemSelectorReturnType(),
new URLItemSelectorReturnType()
}));