From b7b05803cb1f5081f3044e1322130308b5b2b244 Mon Sep 17 00:00:00 2001 From: Nabil Adouani Date: Wed, 24 Feb 2021 20:02:53 +0100 Subject: [PATCH] #1804 Fix case template quick sort options --- .../components/organisation/OrgCaseTemplateListCmp.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/app/scripts/components/organisation/OrgCaseTemplateListCmp.js b/frontend/app/scripts/components/organisation/OrgCaseTemplateListCmp.js index 15d5588ec0..3025da8b0f 100644 --- a/frontend/app/scripts/components/organisation/OrgCaseTemplateListCmp.js +++ b/frontend/app/scripts/components/organisation/OrgCaseTemplateListCmp.js @@ -102,12 +102,18 @@ }); }; + this.sortBy = function(sort) { + self.list.sort = sort; + self.list.update(); + self.filtering.setSort(sort); + }; + this.sortByField = function(field) { var context = this.filtering.context; var currentSort = Array.isArray(context.sort) ? context.sort[0] : context.sort; var sort = null; - if(currentSort && currentSort.substr(1) !== field) { + if(currentSort.substr(1) !== field) { sort = ['+' + field]; } else { sort = [(currentSort === '+' + field) ? '-'+field : '+'+field];