Search code examples
liferayhookliferay-6liferay-themeliferay-aui

How to create and call action button for User entity


I have created a portlet and which has the user form and on click of save buton in the class I am calling UserLocalServiceUtil.addUser() to save the user info in DB. With the following code I am printing list of users in my 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" />

Now the screen shot for my code is as follows,

enter image description here

Now I wanted to enable the action controls for the users list. Is there any way to call the API methods to call and enable the follwoing actions buttons with functionality.

enter image description here

If that is not possible with API methods, How can add action buttons for users list so that I can edit user info.

Any suggestions that In which way I can achieve my task


Solution

  • What you are searching for is implemented in the following file: https://github.com/liferay/liferay-portal/blob/6.2.x/portal-web/docroot/html/portlet/users_admin/user_action.jsp

    That file is included inside the last column of the search iterator.