Tuesday, 16 September 2014

Change default number of items OR Items per page in Alfresco Share


When we work with Alfresco Share, many a times we feel or do have a requirement of changing the number of items per page.
Either we want to reduce or increase the number of items in our document library/repository.
By default, 50 items will be displayed on a single document library page in alfresco share.
If you want to change it, just customize documentlist.get.html.ftl file

Steps:
1) Find the file documentlist.get.html.ftl (Location -> tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\documentlibrary\documentlist.get.html.ftl)

NOTE : To make changes, extend this file. Do not directly modify this file.

2) In the setOptions method, you will find various options already set like : showFolders, simpleView,repositoryBrowsing,useTitle,userIsSiteManager, etc.
   Add one more option "pageSize" with your value say "25".
 
   So, your file will now end with something like this (assuming you want the number of items per page as 25):
 
 
   ...
   ...
   useTitle: ${(useTitle!true)?string},
      userIsSiteManager: ${(userIsSiteManager!false)?string},
 pageSize: 25
   }).setMessages(
      ${messages}
   );
//]]></script>
</@>

3) No need to restart the alfresco server. Go to http://localhost:8080/share/service/index and click "Refresh Web Scripts" button.

4) Go to your alfresco share documentlibrary/repository and check the results.
NOTE: Hard refresh or clear browser cookies/cache if correct results do not appear.