Forums de discussion

Pagination for AssetPublisher ADT

thumbnail
Andew Jardine, modifié il y a 9 années.

Pagination for AssetPublisher ADT

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
Hey Guys,

I'm a total n00b for freemarker. I'm trying to create an ADT template for the asset publisher. In the ADT I want to add the pagination, and configure the asset publisher not to show it. Right now I am trying to figure out how to get the total items (total total, not page total) in the ADT. I thought using


entries?size


Would do it, but that just gives me the page size. I'm using a dynamic view and I can see in the /html/portlet/asset_publisher/view_dynamic_list.jspf where the results are added to the DDMTemplate. It does look like the results is actually a subset based on this --


			Hits hits = AssetUtil.search(request, assetEntryQuery, start, end);
			total = hits.getLength();
			searchContainer.setTotal(total);
			results = AssetUtil.getAssetEntries(hits);


and then this is passed into the template --


				<c:choose>
					<c:when test="<%= portletDisplayDDMTemplateId > 0 %>">
						&lt;%= PortletDisplayTemplateUtil.renderDDMTemplate(pageContext, portletDisplayDDMTemplateId, results, contextObjects) %&gt;
					</c:when>
					<c:otherwise>
						&lt;%@ include file="/html/portlet/asset_publisher/view_dynamic_list_asset.jspf" %&gt;
					</c:otherwise>
				</c:choose>


Does anyone know how to get the total results across all pages? Assuming this is possible...
thumbnail
James Falkner, modifié il y a 9 années.

RE: Pagination for AssetPublisher ADT

Liferay Legend Publications: 1399 Date d'inscription: 17/09/10 Publications récentes
Yep, it's impossible to get the full list without writing the query code yourself. Even the out of the box asset publisher will never retrieve the "full list" in case there are thousands or millions of entries. You could try to set the search.container.page.default.delta property to some ridiculously high number, but I've not tried this.
thumbnail
Andew Jardine, modifié il y a 9 années.

RE: Pagination for AssetPublisher ADT

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
Right -- the more I think about this the more that makes sense. The AssetPublisher isn't querying the database for results, it's more likely to be using a search against Lucene. Boo. Ah well, time for plan B.

Thanks James.