留言板

Pagination not showing

Julian Pfeil,修改在7 年前。

Pagination not showing

Junior Member 帖子: 72 加入日期: 16-3-1 最近的帖子
(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,修改在7 年前。

RE: Pagination not showing (答复)

Junior Member 帖子: 72 加入日期: 16-3-1 最近的帖子
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>