【问题标题】:How to create and call action button for User entity如何为用户实体创建和调用操作按钮
【发布时间】:2015-03-30 23:26:41
【问题描述】:

我创建了一个 portlet,它具有用户表单,并且在单击类中的保存按钮时,我正在调用 UserLocalServiceUtil.addUser() 以将用户信息保存在 DB 中。使用以下代码,我在view.jsp 中打印用户列表。

<liferay-ui:search-container delta="10" emptyResultsMessage="no-users-were-found">
        <liferay-ui:search-container-results
                results="<%=UserLocalServiceUtil.getUsers(searchContainer.getStart(), searchContainer.getEnd())%>"
       total="<%=UserLocalServiceUtil.getUsersCount()%>" />
        <liferay-ui:search-container-row
                className="com.liferay.portal.model.User"
                keyProperty="userId"
                modelVar="user"
        >
                <liferay-ui:search-container-column-text
                        name="name"
                        value="<%= user.getFullName() %>"
                />
                <liferay-ui:search-container-column-text
                        name="first-name"
                        property="firstName"
                />
                <liferay-ui:search-container-column-text
                        name="last-name"
                        property="lastName"
                />
                <liferay-ui:search-container-column-text
                        name="screen-name"
                        property="screenName"
                />
        </liferay-ui:search-container-row>
        <liferay-ui:search-iterator />
</liferay-ui:search-container>
<liferay-ui:search-container delta="10" emptyResultsMessage="no-users-were-found" />

现在我的代码截图如下,

现在我想为用户列表启用操作控件。有什么方法可以调用 API 方法来调用和启用具有功能的以下操作按钮。

如果 API 方法无法做到这一点,如何为用户列表添加操作按钮,以便我可以编辑用户信息。

我可以通过何种方式完成任务的任何建议

【问题讨论】:

    标签: liferay hook liferay-6 liferay-theme liferay-aui


    【解决方案1】:

    您要搜索的内容在以下文件中实现:https://github.com/liferay/liferay-portal/blob/6.2.x/portal-web/docroot/html/portlet/users_admin/user_action.jsp

    该文件包含在搜索迭代器的最后一列中。

    【讨论】:

    • 我在单独的 portlet 中执行此操作。所以你想让我在我的 portlet 中添加建议的文件并将其包含在搜索迭代器的最后一列中?
    • 可悲的是不允许跨上下文,所以你必须复制它......然后你应该确保调用正确的“核心”动作......但很可能之后他们将返回标准页面的操作。我不确定,因为我从来没有这样做过。另一种方法是在您的 portlet 中复制大部分 LR 核心,但我非常不喜欢这个解决方案...另一种方法是直接修改(通过 ext)用户 portlet...问题,正如我已经说过的,是该系统并非旨在以这种方式在同一个组中工作,而只能在同一个门户实例中... :(
    猜你喜欢
    • 1970-01-01
    • 2017-08-02
    • 1970-01-01
    • 1970-01-01
    • 2012-02-07
    • 1970-01-01
    • 1970-01-01
    • 2015-06-25
    • 1970-01-01
    相关资源
    最近更新 更多