AnsweredAssumed Answered

How to sort on name in Document Library or javascript

Question asked by loftux Moderator on Sep 9, 2010
Latest reply on Dec 29, 2011 by kwilliamsjr
This is how you can sort on document name in Alfresco Share Document Library. If you like me don't like the semi-random listing  :?
Locate tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/filters.lib.js
For the filters you would like sorted, sample for default/path filter

         default: // "path"
            filterParams.variablePath = false;
            filterQuery = "+PATH:\"" + parsedArgs.pathNode.qnamePath + "/*\"";
            filterParams.query = filterQuery + filterQueryDefaults;
            //Adding sort parameters
            filterParams.sort = [
                                      column: "@{}name",
                                      ascending: true
                                   column: "@{}modified",
                                   ascending: false
The important step here is that sorting on name only works if you add one additional sort field. If you only add cm:name for sort, it is just ignored. I think (haven't tested yet) this is applicable to other javascript searches where you need to do search on fields that are multilingual and/or tokenized. I'm not sure what is the cause that only name sort fails, the issue has been reported several times in Jira, so I do not add a new issue there, but added a comment to