• Search Container In Liferay

    Search Container is an utility by Liferay for showing the data from table(s) in structured way with many features such pagination of items, searching, sorting and many more.


    <%@page import="java.util.List"%> <%@page import="com.liferay.portal.kernel.model.User"%> <%@page import="com.liferay.portal.kernel.util.ListUtil"%> <%@page import="com.liferay.portal.kernel.service.UserLocalServiceUtil"%> <%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %> <% List<User> users = UserLocalServiceUtil.getUsers(-1,-1); System.out.println(users.size()); %> <liferay-ui:search-container total="<%=users.size()%>" var="searchContainer" delta="1" deltaConfigurable="true" emptyResultsMessage="Oops. There Are No Users To Display, Please add Users"> <liferay-ui:search-container-results results="<%=ListUtil.subList(users, searchContainer.getStart(),searchContainer.getEnd())%>" /> <liferay-ui:search-container-row className="com.liferay.portal.kernel.model.User" modelVar="user" keyProperty="userId" > <liferay-ui:search-container-column-text name="User Id" value="${user.userId}"/> <liferay-ui:search-container-column-text name="firstName" property="firstName"/> <liferay-ui:search-container-column-text name="lastName" property="lastName"/> <liferay-ui:search-container-column-text name="Email" value="${user.emailAddress}"/> </liferay-ui:search-container-row> <liferay-ui:search-iterator /> </liferay-ui:search-container>

    Above search Container have minimal tags just to show you the demonstration of it. lets see the different tags used in the search container one by one.

    < liferay-ui:search-container>

    This is the main tag used to declare the search container.
    total : total number of items available in the table.
    delta : items per page
    deltaConfigurable : Flag to allow user to change the item per page from UI
    emptyResultsMessage : Message To Display when there are no items

    < liferay-ui:search-container-results>

    Using this tag we can iterate through the list of items.
    result : A variable to hold result

    < liferay-ui:search-container-row>





  • 2 comments:

    1. Business phone systems are crucial to your business's success. Read about business phone systems and the benefits of having a simple pbx phone system. Local Business Coupons New York,

      ReplyDelete