RE: Total count of results in ADT of an Asset Publisher in Liferay 7

thumbnail
Charalampos Chrysikopoulos, modified 7 Years ago. Junior Member Posts: 79 Join Date: 12/9/11 Recent Posts

Hello,

 

is there a way to get the total number of results in an ADT in an Asset Publisher? For example, lets say, I want to type for every asset that it is the 3rd of the 124 total results. If I enable the pagination (20 results per page), how could I get in my freemarker ADT the number 124 (total number of results)?

 

Thanks in advance.

thumbnail
Minhchau Dang, modified 7 Years ago. Liferay Master Posts: 598 Join Date: 10/22/07 Recent Posts
Charalampos Chrysikopoulos:

is there a way to get the total number of results in an ADT in an Asset Publisher? For example, lets say, I want to type for every asset that it is the 3rd of the 124 total results. If I enable the pagination (20 results per page), how could I get in my freemarker ADT the number 124 (total number of results)?

In theory, as long as you include a new variable as part of the optional contextObjects map mentioned in the liferay-ddm:template-renderer tag library documentation, then your ADT can have access to any value it wants.

In practice, it's complicated, because you'll need to customize Asset Publisher to feed that value to your ADT. Additionally, if you look at view_dynamic_list.jspf, you'll see that asset publisher makes a util method call that returns a list of AssetEntryResult objects, which do not include the individual totals as part of their metadata. This means that the only total you have to provide to your ADT is the global total that is stored on the SearchContainer.