Creating Liferay Search Container GUIs

Time for some basic knowledge:

What does the liferay-ui tld say about the search container? How is it possible to create nice and functional search container GUIS? Read the following and you know more:

The search container is always rendering a set of rows that contain one or more columns to display search results. You may change the way the search container is rendering the rows but in the end it will always be a set of rows. So what we are going to do now will only affect the rows itself. We won't change the search container to display grids or something similar.

The liferay search container is structured as follows:

<liferay-ui:search-container > 
<!-- Calculate results-->
<!--Create the rows that display the search results-->
</liferay-ui:search-container >

Because we will only care for the rows, we will jump right in and take a look at some of the tags you can use:


<liferay-ui:search-container-column-text name="userName" property="userName" />

The column text tag creates a label filled with a header text (name) and a populated value of the search container entity (property). In our case, the property userName would be taken from our entity and displayed.


<liferay-ui:search-container-column-jsp path="/your.jsp" align="right" />

Very powerful! Allows to create a complete JSP that will be displayed in every row. By using this tag you can create your own forms with AlloyUI or standard HTML / Javascript and let the search container do all the magic.


<liferay-ui:search-container-column-button align="right" href="<%= yourUrl %>" name='clickMe' />

Allows to create a button pretty easy and connect it to a URL.


<liferay-ui:ratings classPK="<%=user.getUserId()%>" className="<%=User.class.getName() %>" />
Shows the score for the retrieved object.

These tags allow you to create very fast very powerful search container GUIs. I´ve only touched the surface here and there is a lot more of liferay magic that you can discover. Just take a look at the TLD which you can find here: 


If you like this tutorial it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.