Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Clément Derodit
[Solved] Search-container shows blank page on Next
October 11, 2011 1:15 AM
Answer

Clément Derodit

Rank: New Member

Posts: 2

Join Date: September 30, 2011

Recent Posts

Hi everyone,

For my project, I have to display a list of users. This list has two columns, one for the user's name and one for his id number.
This list can be very long so I need to paginate it.

I'm using a <liferay-ui:search-container> to achieve that. I display my portlet in a pop-up window.

After loading, I can see the created table with my data. But everytime I click on next or select a page number directly, the page goes blank and no error message is displayed.


Here is the code of my jsp :

 1
 2<%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
 3<%@taglib uri="http://liferay.com/tld/aui" prefix="aui"%>
 4<%@taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
 5
 6<%@page import="java.util.ArrayList"%>
 7<%@page import="java.util.List"%>
 8<%@page import="javax.portlet.RenderResponse"%>
 9<%@page import="javax.portlet.PortletURL"%>
10<%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%>
11<%@page import="com.liferay.portal.kernel.util.ListUtil" %>
12<%@page import="fr.msa.agora.z80tech.beans.RessourceDossierBean"%>
13<portlet:defineObjects />
14
15<portlet:actionURL var="ressource" windowState="<%= LiferayWindowState.NORMAL.toString() %>"></portlet:actionURL>
16
17<%
18        List<RessourceDossierBean> lListeRessources = (ArrayList<RessourceDossierBean>) portletSession.getAttribute("listeRessources");
19%>
20    <liferay-ui:search-container delta="10" emptyResultsMessage="No Results Were found for the Selected Criteria">
21        <liferay-ui:search-container-results total="<%= lListeRessources.size() %>" results="<%= ListUtil.subList(lListeRessources,searchContainer.getStart(),searchContainer.getEnd()) %>" />
22        <liferay-ui:search-container-row modelVar="ressourceDossierBean" className="fr.msa.agora.z80tech.beans.RessourceDossierBean" >
23
24            <liferay-ui:search-container-column-text name="Dossier" property="idRessource" orderable="<%=true%>" orderableProperty="idRessource" />
25            <liferay-ui:search-container-column-text name="Raison Sociale" property="raisonSociale" orderable="<%=true%>" orderableProperty="raisonSociale" />
26
27        </liferay-ui:search-container-row>
28        <liferay-ui:search-iterator paginate="true" />
29    </liferay-ui:search-container>


In my view.jsp, I call my jsp with this code :

 1
 2<%
 3final String lCible = (String)renderRequest.getAttribute("z80portlet_page");
 4%>
 5
 6<portlet:renderURL var="pageCourante" windowState="<%= LiferayWindowState.EXCLUSIVE.toString() %>">
 7    <portlet:param name="jspPage" value="<%=lCible%>" />
 8</portlet:renderURL>
 9
10<div>
11    <aui:script>      
12        function showPopup()
13        {
14          AUI().use('aui-dialog', 'aui-io', 'event', 'event-custom',
15                  function(A) {
16            var dialog = new A.Dialog({
17            title: '<%=lTitle %>',
18            height: 480,
19            width: 640,
20            centered: true,
21            draggable: false,
22            resizable: false,
23            close: false,
24            modal: true
25                }).plug(A.Plugin.IO, {uri: '<%=pageCourante%>'}).render();
26               
27                dialog.show();
28            });
29        }
30
31        showPopup();
32    </aui:script>


It seems the problem resides in the windowState of my jsp after clicking on next (it sould be LiferayWindowState.NORMAL but change into LiferayWindowState.EXCLUSIVE everytime emoticon ) When I change it to NORMAL in the url, it works (but it seems the paging doesn't work either emoticon )

I'm using Liferay 6.0.6 CE with an Apache Tomcat Server 6.0.29

Thanks for your help.


Solution : (add this in the jsp)

<%@page import="javax.portlet.PortletURL"%>

<%
PortletURL lPortletURL = renderResponse.createRenderURL();
lPortletURL.setWindowState(LiferayWindowState.NORMAL);
%>

<liferay-ui:search-container delta="10" emptyResultsMessage="No Results Were found" iteratorURL="<%= lPortletURL %>">