From 3cade9c053c51eb9b95a0308c4531b4df98159a9 Mon Sep 17 00:00:00 2001 From: Francois Zaninotto Date: Wed, 18 Mar 2015 21:44:25 +0100 Subject: [PATCH] Allow referenced_list to be ordered by configuration --- src/javascripts/ng-admin/Crud/repository/RetrieveQueries.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/javascripts/ng-admin/Crud/repository/RetrieveQueries.js b/src/javascripts/ng-admin/Crud/repository/RetrieveQueries.js index f832cecd..48dd0eef 100644 --- a/src/javascripts/ng-admin/Crud/repository/RetrieveQueries.js +++ b/src/javascripts/ng-admin/Crud/repository/RetrieveQueries.js @@ -91,7 +91,6 @@ define(function (require) { _page: (typeof (page) === 'undefined') ? 1 : parseInt(page, 10), _perPage: listView.perPage() }; - if (sortField && sortField.split('.')[0] === listView.name()) { params._sortField = sortField.split('.')[1]; params._sortDir = sortDir; @@ -202,6 +201,7 @@ define(function (require) { referencedLists = view.getReferencedLists(), calls = [], referencedList, + referencedView, filter, i, j; @@ -210,8 +210,8 @@ define(function (require) { referencedList = referencedLists[i]; filter = {}; filter[referencedList.targetReferenceField()] = entityId; - - calls.push(self.getRawValues(referencedList.getReferencedView(), 1, filter, sortField || referencedList.sortField(), sortDir || referencedList.sortDir())); + referencedView = referencedList.getReferencedView(); + calls.push(self.getRawValues(referencedView, 1, filter, sortField || (referencedView.name() + '.' + referencedList.sortField()), sortDir || referencedList.sortDir())); } return this.$q.all(calls)