简体   繁体   English

如何为liferay 7.0创建简单的数据展示portlet?

[英]How to create simple data presentation portlet for liferay 7.0?

I need to create simple data presentation portlet for new version of liferay, but can't really find the proper way.我需要为新版本的liferay 创建简单的数据呈现portlet,但无法真正找到正确的方法。

I created backend with service builder and added custom methods for listing, adding, etc. Created mvc portlet based on this tutorial [ https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/updating-the-view] and it works, but there is some problems: - It is based on deprecated alloyUI and I wan't to move it to soy/metal.js (don't have any experience with any of them), - result table should have sorting/filtering capabilities, server side probably because it have to be compatible with WCAG so I wan't to keep html and js as clean as possible.我使用服务构建器创建了后端,并添加了用于列出、添加等的自定义方法。基于本教程创建了 mvc portlet [ https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/updating-the -view]并且它可以工作,但存在一些问题: - 它基于已弃用的alloyUI,我不想将其移动到 soy/metal.js(对它们中的任何一个都没有任何经验),-结果表应该具有排序/过滤功能,服务器端可能是因为它必须与 WCAG 兼容,所以我不想保持 html 和 js 尽可能干净。

If I understand properly, I need to replace this part below for something that works with metal.js and soy?如果我理解正确,我需要将下面的这部分替换为适用于 metal.js 和 soy 的东西吗?

<liferay-ui:search-container total="<%=EntryLocalServiceUtil.getEntriesCount()%>">
<liferay-ui:search-container-results
    results="<%=EntryLocalServiceUtil.getEntries(scopeGroupId.longValue(),
                    guestbookId, searchContainer.getStart(),
                    searchContainer.getEnd())%>" />    
<liferay-ui:search-container-row
    className="com.liferay.docs.guestbook.model.Entry" modelVar="entry">    
    <liferay-ui:search-container-column-text property="message" />    
    <liferay-ui:search-container-column-text property="name" />    
</liferay-ui:search-container-row>    
<liferay-ui:search-iterator />    
</liferay-ui:search-container>

How is sorting/filtering implemented in liferay-7.0? liferay-7.0 是如何实现排序/过滤的? Do I have to use management bar or is it possible to allow users to sort by column (clicking on column header).我必须使用管理栏还是可以允许用户按列排序(单击列标题)。

I would not change the code.我不会更改代码。 You are not using AlloyUI but Liferay UI tags which currently happen to use AlloyUI but will eventually switch to Metal.您使用的不是 AlloyUI,而是 Liferay UI 标签,这些标签目前碰巧使用 AlloyUI,但最终会切换到 Metal。

If you want to stay with the server side rendering I would not waste effort on redeveloping search container.如果您想继续使用服务器端渲染,我不会浪费精力重新开发搜索容器。 It should work fine now and will in the future.它现在应该可以正常工作,将来也可以。

Sorting should be supported by the search container.搜索容器应该支持排序。 You just need to indicate it in the columns but filtering is more tricky.您只需要在列中指出它,但过滤更棘手。 Liferay does more search then filtering. Liferay 比过滤做更多的搜索。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM