As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Is there a way to limit the number of documents shown on a Document Library page?
please use the search for "pageSize" this topic has been covered many times
After checking/modifying dozens of files, the solution is to modify the ./tomcat/webapps/share/components/documentlibrary/documentlist-min.js file. Might not be the ultimate solution but it works.
Hi,
In Alfresco 5.2, if you want to config number of items per page in Document Library, the steps are the following:
1.- Copy the file "documentlist-v2.get.js" to "{Alfresco}\tomcat\shared\classes\alfresco\web-extension\site-webscripts\org\alfresco\components\documentlibrary"
2.- In this file we have to add the following line:model.widgets[1].options.pageSize = 10;
3.- We will add this line at the end of the code of widgets function:
function widgets(){ var useTitle = "true"; var docLibConfig = config.scoped["DocumentLibrary"]; if (docLibConfig != null) { var tmp = docLibConfig["use-title"]; useTitle = tmp != null ? tmp : "true"; }
var docListToolbar = { id: "DocListToolbar", name: "Alfresco.DocListToolbar", assignTo: "docListToolbar", options: { siteId: (page.url.templateArgs.site != null) ? page.url.templateArgs.site : "", rootNode: toolbar.rootNode != null ? toolbar.rootNode : "", repositoryRoot: toolbar.rootNode, hideNavBar: Boolean(toolbar.preferences.hideNavBar), repositoryBrowsing: toolbar.rootNode != null, useTitle: (useTitle == "true"), syncMode: toolbar.syncMode != null ? toolbar.syncMode : "", createContentByTemplateEnabled: model.createContentByTemplateEnabled, createContentActions: model.createContent } }; var documentList = { id : "DocumentList", name : "Alfresco.DocumentList", options : { syncMode : model.syncMode != null ? model.syncMode : "", siteId : (page.url.templateArgs.site != null) ? page.url.templateArgs.site : "", containerId : template.properties.container != null ? template.properties.container : "documentLibrary", rootNode : model.rootNode != null ? model.rootNode : "null", repositoryRoot : model.rootNode, usePagination : (args.pagination == "true"), sortAscending : (model.preferences.sortAscending != null ? model.preferences.sortAscending : true), sortField : model.preferences.sortField != null ? model.preferences.sortField : "cm:name", showFolders : (model.preferences.showFolders != null ? model.preferences.showFolders : true), hideNavBar: (model.preferences.hideNavBar != null ? model.preferences.hideNavBar : false), simpleView : model.preferences.simpleView != null ? model.preferences.simpleView : "null", viewRenderers: model.viewRenderers, viewRendererName : model.preferences.viewRendererName != null ? model.preferences.viewRendererName : "detailed", viewRendererNames : model.viewRendererNames != null ? model.viewRendererNames : ["simple", "detailed", "gallery", "filmstrip"], highlightFile : page.url.args["file"] != null ? page.url.args["file"] : "", replicationUrlMapping : model.replicationUrlMapping != null ? model.replicationUrlMapping : "{}", repositoryBrowsing : model.rootNode != null, useTitle : (model.useTitle != null ? model.useTitle == "true" : true), userIsSiteManager : model.userIsSiteManager, associatedToolbar: { _alfValue: "docListToolbar", _alfType: "REFERENCE" }, commonComponentStyle : model.commonComponentStyle, suppressComponent : model.suppressComponent, filmstripImageLazyLoading: model.filmstripImageLazyLoading == "true" } }; if (model.repositoryUrl != null) { documentList.options.repositoryUrl = model.repositoryUrl; } model.widgets = [docListToolbar, documentList];model.widgets[1].options.pageSize = 10;}
4.- In this case we have establish ten items per page
5.- We must restart Alfresco Service and after that this configuration will be available
Regards,
HI Calvo,
Thanks alot for the explanation, I will try to do this later this week. Right now the modification we did works and good for a demo/mock up. But for sure your approach looks a bit more mature.
Zsolt Putnoky