From d17402f873a83c9ab5f696894a9bb38d21b6839a Mon Sep 17 00:00:00 2001 From: Heiko Kernbach Date: Thu, 21 Aug 2014 16:43:17 +0200 Subject: [PATCH] changed behaviour of sorting documents - front-end --- .../aardvark/frontend/js/collections/arangoDocuments.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/apps/system/aardvark/frontend/js/collections/arangoDocuments.js b/js/apps/system/aardvark/frontend/js/collections/arangoDocuments.js index bac704bc12..072428e81e 100644 --- a/js/apps/system/aardvark/frontend/js/collections/arangoDocuments.js +++ b/js/apps/system/aardvark/frontend/js/collections/arangoDocuments.js @@ -94,8 +94,13 @@ query += this.setFiltersForQuery(bindVars); // Sort result, only useful for a small number of docs if (this.getTotal() < 12000) { - query += " SORT TO_NUMBER(x." + this.getSort() + ") == 0 ? x." - + this.getSort() + " : TO_NUMBER(x." + this.getSort() + ")"; + if (this.getSort() === '_key') { + query += " SORT TO_NUMBER(x." + this.getSort() + ") == 0 ? x." + + this.getSort() + " : TO_NUMBER(x." + this.getSort() + ")"; + } + else { + query += " SORT x." + this.getSort(); + } } if (bindVars.count !== 'all') {