13 September, 2012

Liferay search container without database

If you want to use search container in which data will come from Array rather than database,
you can simply use below code :




<liferay-ui:search-container>
        <liferay-ui:search-container-results
            results="<%= stringList %>"
            total="<%= stringList.size() %>"
        />

        <liferay-ui:search-container-row
            className="java.lang.String"
            modelVar="listMember"
        >


                                                                           OR

<%
   List<String> testList = new ArrayList<String>();
   for(int i=0;i<=50;i++)
   {
       testList.add("String " + i);
   }
%>
       <liferay-ui:search-container delta="10" emptyResultsMessage="No Items were found!!">
        <liferay-ui:search-container-results results="<%=ListUtil.subList(testList, searchContainer.getStart(), searchContainer.getEnd())%>" total="${testList.size()}" />
        <liferay-ui:search-container-row className="String" modelVar="data">
            <liferay-ui:search-container-column-text name="name" value="<%=data %>" />
        </liferay-ui:search-container-row>
    </liferay-ui:search-container>

Popular Posts

Featured Post

Liferay 7.3 compatibility matrix

Compatibility Matrix Liferay's general policy is to test Liferay Portal CE against newer major releases of operating systems, open s...