From 659a2eae05505d55d6d69dcf1d98fb660e3fe546 Mon Sep 17 00:00:00 2001 From: Mickey Young Date: Fri, 7 May 2021 14:00:15 -0400 Subject: [PATCH] [DAT-436] Sort the data table with secondary column --- .../list/components/results/resultsTable.component.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/list/components/results/resultsTable.component.tsx b/src/modules/list/components/results/resultsTable.component.tsx index 3edc92e..346a0d0 100644 --- a/src/modules/list/components/results/resultsTable.component.tsx +++ b/src/modules/list/components/results/resultsTable.component.tsx @@ -8,11 +8,11 @@ import MechanismModel from "../../../shared/models/mechanism.model"; const cellStyle = {padding: "0px 5px"}; const tableColumns = [ - {title: "Mechanism", field: "name", cellStyle: cellStyle, defaultSort: "asc" as ('asc' | 'desc')}, - {title: "OU", field: "ou", cellStyle: cellStyle}, - {title: "Agency", field: "agency", cellStyle: cellStyle}, - {title: "Partner", field: "partner", cellStyle: cellStyle}, - {title: "Status", field: "status", cellStyle: cellStyle}, + {title: "Mechanism", field: "name", cellStyle: cellStyle, defaultSort: "asc" as ('asc' | 'desc'), customSort: (a, b) => (a.name + a.ou) > (b.name + b.ou) ? 1 : -1}, + {title: "OU", field: "ou", cellStyle: cellStyle, defaultSort: "asc" as ('asc' | 'desc'), customSort: (a, b) => (a.ou + a.name) > (b.ou + b.name) ? 1 : -1}, + {title: "Agency", field: "agency", cellStyle: cellStyle, defaultSort: "asc" as ('asc' | 'desc'), customSort: (a, b) => (a.agency + a.name) > (b.agency + b.name) ? 1 : -1}, + {title: "Partner", field: "partner", cellStyle: cellStyle, customSort: (a, b) => (a.partner + a.name) > (b.partner + b.name) ? 1 : -1}, + {title: "Status", field: "status", cellStyle: cellStyle, customSort: (a, b) => (a.status + a.name) > (b.status + b.name) ? 1 : -1}, ]; const localization = {