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>

Rate Me:

2 Discussion:

James McCarthy said...

The site was absolutely fantastic! Lots of great information and inspiration, both of which we all need!b Keep 'em coming... you all do such a great job at such Concepts... can't tell you how much I, for one appreciate all you do!

AimIT Software - software company

Jignesh Vachhani said...

Thanks James