Showing posts with label DXP. Show all posts
Showing posts with label DXP. Show all posts

Tuesday, April 18, 2017

Liferay7: Changes in search container tag

Hi,

Liferay search container is the very common practice for liferay developer to display list of data. So, here is am writing something interesting for search container in liferay new version called Liferay7 or Liferay DXP.

Earlier or older version, we use or setup search container tag like below....

<liferay-ui:search-container
emptyResultsMessage="no-users-were-found"
iteratorURL="<%= iteratorURL %>"
>
          <liferay-ui:search-container-results
                   results="<%= UserLocalServiceUtil.getUser(themeDisplay.getUserId()), searchContainer.getStart(), searchContainer.getEnd(), searchContainer.getOrderByComparator()) %>"
                     total="<%= UserLocalServiceUtil.getUser(themeDisplay.getUserId()).size() %>"
        />
       ...
       ...
       ...
</liferay-ui:search-container>


result & total attribute are configure in the liferay-ui:search-container-results tag. While in DXP version the total attribute move to the liferay-ui:search-container tag. So, we just have to
setup results attribute into liferay-ui:search-container-results. Below is the example how we use search container in liferay7 or DXP.


<liferay-ui:search-container
emptyResultsMessage="no-users-were-found"
iteratorURL="<%= iteratorURL %>"
 total="<%= UserLocalServiceUtil.getUserCount(themeDisplay.getUserId()) %>"
>
              <liferay-ui:search-container-results
                      results="<%= UserLocalServiceUtil.getUser(themeDisplay.getUserId()), searchContainer.getStart(), searchContainer.getEnd(), searchContainer.getOrderByComparator()) %>"            
             />
       ...
       ...
       ...
</liferay-ui:search-container>


total is moved from liferay-ui:search-container-results to liferay-ui:search-container tag is only change in search container in Liferay7 or DXP.

HTH!!

Regards,
Ketan Savaliya

Tuesday, March 28, 2017

Liferay7 : Removed the liferay-ui:journal-article Tag

 Hi,

In liferay till version 6.2, Very easy way to display journal article using `liferay-ui:journal-article`. The `liferay-ui:journal-article` tag has been removed.  Now, You should use the `liferay-ui:asset-display` tag instead. below is the piece example for how to use it.


**Example**

Old code:

    <liferay-ui:journal-article
        articleId="<%= article.getArticleId() %>"
    />

New code:   

 <liferay-ui:asset-display
            className="<%= JournalArticle.class.getName() %>"
            classPK="<%= journalArticle.getResourcePrimKey() %>"
            template="<%= AssetRenderer.TEMPLATE_FULL_CONTENT %>"
        />

HTH!!