Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Liferay - Using the search container to present your data

    • 0
    • 4
    • 1
    • 3
    • 0
    • 0
    • 0
    • 0
    • 1.80k
    Comment on it

    The Liferay Search container can provide us the many features using that we can simply show the data in grid format and apply pagination on that. We can configure other multiple tags inside the search container.

    Syntax:-

     <liferay-ui:search-container>
        <liferay-ui:search-container-results/>  
        <liferay-ui:search-container-row>              
        <liferay-ui:search-container-column-text/>
        <liferay-ui:search-container-column-text/>     
        </liferay-ui:search-container-row>
        <liferay-ui:search-iterator/>
    </liferay-ui:search-container>
    

    Example:-

    <liferay-portlet:renderURL varImpl="iteratorURL">
    
        <portlet:param name="Name" value="<%= Name %>" />
    
        <portlet:param name="Age" value="<%= String.valueOf(Age) %>" />
    
        <portlet:param name="Address" value="<%= String.valueOf(Address) %>" />
    
        <portlet:param name="mvcPath" value="/html/jsp/student&#95;search.jsp" />
    
    </liferay-portlet:renderURL>
    
    
    
    <liferay-ui:search-container
        emptyResultsMessage="there-are-no-students"
        headerNames="Name,Age,Address"
        iteratorURL="<%= iteratorURL %>
        delta="20"
        deltaConfigurable="true"
        total="<%=StudentLocalServiceUtil.getStudentsCount()%>">
    
         <liferay-ui:search-container-results
    results="<%= StudentLocalServiceUtil.getStudents(searchContainer.getStart(), searchContainer.getEnd()) %>"/>
    
    </liferay-ui:search-container>
    

    In above example we can use Search Container with following attributes and inside that we use the "liferay-ui:search-container" Tag to contain the List of Objects.

    Empty Results Message:- If the data is not there then it will show the message we have given to this attribute

    Header Names:- In the result required Column Header name we will pass as comma separated values.

    Delta:- This will decide how many record for page.

    Delta Configurable:- This will give the option to change Delta values after result renders in the JSP page means end User can change records display per page.

    Hope this will help you :)

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: