Search Container in liferay


List<Article> articles= ArticleLocalServiceUtil.getArticles(0, -1);


<liferay-ui:search-container delta="4" emptyResultsMessage="Sorry. There are no items to display." iteratorURL="<%= iteratorURL %>">

<liferay-ui:search-container-results  total="<%= articles size() %>" results="<%= ListUtil.subList(articles, searchContainer.getStart(), searchContainer.getEnd()) %>"/>

<liferay-ui:search-container-row modelVar="article" className="Article">
<% articleDetailsURL.setParameter("articleId", Long.toString(article.getArticleId())); %>
<liferay-ui:search-container-column-text name="Article Title" property="articleTitle" href="<%= articleDetailsURL.toString() %>" />
<liferay-ui:search-container-column-text name="Desc" property="description" />
<liferay-ui:search-container-column-text name="Date ">
<fmt:formatDate value="<%= article.getCreatedDate() %>"
pattern="dd/MM/yyyy" />
</liferay-ui:search-container-column-text>

<% deleteArticleDetailsURLURL.setParameter("articleId", Long.toString(article.getArticleIdId())); %>
<liferay-ui:search-container-column-text name="Delete"
href="<%= deleteArticleURL.toString() %>" value="delete"/>  //Here we are only one action (delete). If we want to use multiple actions use below tag

<liferay-ui:search-container-column-jsp name="Actions"
path="/jsp/article/actionButton.jsp" />   // Here including the another JSP for More Actions
</liferay-ui:search-container-row>

<liferay-ui:search-iterator
searchContainer="<%= searchContainer %>" />
</liferay-ui:search-container>

====================================================================

actionButton.jsp


<%      
ResultRow row = (ResultRow)
        request.getAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW);


Article article= (Article) row.getObject();

%>

<liferay-ui:icon-menu>
<liferay-ui:icon image="edit" message="EDIT ARTICLE"
url="<%= edirArticleURL.toString() %>" />
<liferay-ui:icon image="delete" message="DELETE ARTICLE"
url="<%= deleteArticleURL.toString() %>" />
</liferay-ui:icon-menu>



Comments

  1. Search Engine Optimization Firms are continuously improving their strategies to provide you the best admission essay writing service for your online business development. They do so many things to improve your search engine rankings and give you increased traffic.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete

Post a Comment

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Opening portlet in popup