From abe3616bc5188055ee90a2bb1e8f067e49b0ed75 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sun, 1 Sep 2019 15:01:12 -0500 Subject: [PATCH] add software column sorter --- .../src/components/listsTable/ListsTable.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/FilterLists.Web.V2/src/components/listsTable/ListsTable.tsx b/src/FilterLists.Web.V2/src/components/listsTable/ListsTable.tsx index 94e0dbce9..cfbf10089 100644 --- a/src/FilterLists.Web.V2/src/components/listsTable/ListsTable.tsx +++ b/src/FilterLists.Web.V2/src/components/listsTable/ListsTable.tsx @@ -62,7 +62,13 @@ export const ListsTable = (props: RouteComponentProps & Props) => { : title="Software" dataIndex={nameof("syntaxId")} - width={160} + sorter={(a, b) => { + const getSoftwareIds = (l: List) => props.software.filter((s: Software) => s.syntaxIds.includes(l.syntaxId)).map(s => s.id); + const aSoftwareIds = getSoftwareIds(a); + const bSoftwareIds = getSoftwareIds(b); + return arraySorter(aSoftwareIds, bSoftwareIds, props.software); + }} + width={140} className={styles.nogrow} render={(syntaxId: number) => syntaxId ? s.syntaxIds.includes(syntaxId))} /> : null} />} {tablePageSize.isNarrowWindow