AnsweredAssumed Answered

fileFolderService list sort natural numbers in name

Question asked by leroux@itldev.fr on Mar 18, 2015
Latest reply on Apr 2, 2015 by leroux@itldev.fr
Hi

My users are used to create folders with numbers in name in order to get a natural sort.
For ex :

|- 1 FOLDER1
|- 2 FOLDER2
|- 3 FOLDER3
|- 4 FOLDER4
|- 5 FOLDER5
|- 6 FOLDER6
|- 7 FOLDER7
|- 8 FOLDER8
|- 9 FOLDER9
|- 10 FOLDER10
|- 11 FOLDER11
|- 12 FOLDER12

They expects folders are displayed in this order but using fileFolderService.list like this


List<Pair<QName, Boolean>> sortProps = new ArrayList() {
         {
            add(new Pair<>(
                  GetChildrenCannedQuery.SORT_QNAME_NODE_IS_FOLDER, false));
            add(new Pair<>(ContentModel.PROP_NAME, true));
         }
      };

      PagingResults<FileInfo> results = fileFolderService.list(parent,
            !onlyFolders, true, null, sortProps, new PagingRequest(
                  skipCount, maxItems));


they get this result :

|- 1 FOLDER1
|- 10 FOLDER10
|- 11 FOLDER11
|- 12 FOLDER12
|- 2 FOLDER2
|- 3 FOLDER3
|- 4 FOLDER4
|- 5 FOLDER5
|- 6 FOLDER6
|- 7 FOLDER7
|- 8 FOLDER8
|- 9 FOLDER9


Is it possible to give fileFolderService.list any option to sort correctly numbers ?

Thanks

Outcomes