Forums de discussion

Pagination not showing

Julian Pfeil, modifié il y a 7 années.

Pagination not showing

Junior Member Publications: 72 Date d'inscription: 01/03/16 Publications récentes
(Liferay 7 ga3)
I have the following JSP resulting in what can be seen in the attached picture.
The problem -as you can see- is, that the pagination for the search container is not shown.

I can add new entries without problems and they show up in the list. Also i did create the iterator URL.

Why is the pagination not shown (i already tried setting the search-iterators pagination-property to true. Even though it is true by default)? What am i doing wrong here?

Kind Regards

<%@ include file="/init.jsp" %>

<portlet:actionurl name="addProduct" var="addProductURL" />


<aui:form action="<%= addProductURL %>" method="post" name="fm">
 <aui:fieldset-group markupview="lexicon">
	<aui:fieldset>
		<aui:input name="productName" size="45" />
		<aui:input name="productSerial" size="45" />
		
		<aui:button-row>
			<aui:button type="submit" />
		</aui:button-row>
	</aui:fieldset>
 </aui:fieldset-group>
</aui:form>


&lt;%
PortletURL iteratorURL = renderResponse.createRenderURL();
List<prproduct> tempResults = ActionUtil.getProducts(request);
int numberResults = tempResults.size();
%&gt;

<p>Number of results: &lt;%= numberResults %&gt;</p>
<p>URL: &lt;%= iteratorURL %&gt;</p>

<liferay-ui:search-container emptyresultsmessage="there-are-no-products" delta="3" iteratorurl="<%=iteratorURL %>">
	<liferay-ui:search-container-results results="<%= ListUtil.subList(tempResults, searchContainer.getStart(), searchContainer.getEnd()) %>" />
	
	<liferay-ui:search-container-row classname="com.inkwell.internet.productregistration.model.PRProduct" keyproperty="productId" modelvar="product">
		
		<liferay-ui:search-container-column-text name="product-name" property="productName" />
		<liferay-ui:search-container-column-text name="product-serial" property="serialNumber" />
	
	</liferay-ui:search-container-row>
	<liferay-ui:search-iterator />
</liferay-ui:search-container>
<p>END</p></prproduct>
Julian Pfeil, modifié il y a 7 années.

RE: Pagination not showing (Réponse)

Junior Member Publications: 72 Date d'inscription: 01/03/16 Publications récentes
Found the solution by brute-force-testing all attributes possible for search-container (search-container taglib reference) that would make sense.

You need to define the total-attribute in the liferay-ui:search-container-tag.

For anyone else who stumbles upon this - here is a minimal example that (adjusted to your classes) should show pagination:

List<item> tempResults = SomeUtil.getList();
<liferay-ui:search-container emptyresultsmessage="there-are-no-products" delta="3" total="<%=tempResults.size() %>">
	<liferay-ui:search-container-results results="<%= ListUtil.subList(tempResults, searchContainer.getStart(), searchContainer.getEnd()) %>" />
	
	<liferay-ui:search-container-row classname="com.inkwell.internet.productregistration.model.PRProduct" keyproperty="productId">
		
		<liferay-ui:search-container-column-text name="product-name" property="productName" />
		<liferay-ui:search-container-column-text name="product-serial" property="serialNumber" />
	
	</liferay-ui:search-container-row>
	<liferay-ui:search-iterator />
</liferay-ui:search-container></item>