updates to some column sorts

This commit is contained in:
Collin M. Barrett 2018-09-29 15:27:41 -05:00
parent 6def1034bb
commit 3aa18fc9ac
3 changed files with 16 additions and 15 deletions

View file

@ -17,12 +17,12 @@ const sortMethod = (a: string, b: string) =>
a
? b
? a > b
? 1
: -1
: 1
: -1;
? -1
: 1
: -1
: 1;
const Cell = (ruleCount: number) =>
ruleCount
? <span>{ruleCount.toLocaleString() }</span>
? <span>{ ruleCount.toLocaleString() }</span>
: null;

View file

@ -6,7 +6,8 @@ import { IColumnVisibility, ITag } from "../../../interfaces";
export const Tags = (columnVisibility: IColumnVisibility[], tags: ITag[]) => {
const tagsSorted = tags.sort((a: ITag, b: ITag) => a.name.localeCompare(b.name));
return ({
Header: <span title="Generic taxonomies applied to the FilterList to provide information about its contents and/or purpose.">Tags</span>,
Header:
<span title="Generic taxonomies applied to the FilterList to provide information about its contents and/or purpose.">Tags</span>,
accessor: "tagIds",
filterable: true,
filterMethod: (f: Filter, r: any[]) => filterMethod(f, r),
@ -46,13 +47,13 @@ const sortMethod = (a: number[], b: number[], tags: ITag[]): any => {
? tags.filter((t: ITag) => a.indexOf(t.id) > -1).map((t: ITag) => t.name).join()
.toLowerCase() >
tags.filter((t: ITag) => b.indexOf(t.id) > -1).map((t: ITag) => t.name).join().toLowerCase()
? -1
: 1
: a.length > b.length
? 1
: -1
: 1
: -1;
: a.length > b.length
? -1
: 1
: -1
: 1;
};
const Cell = (tagIds: number[], tags: ITag[]) =>

View file

@ -18,10 +18,10 @@ const sortMethod = (a: string, b: string) =>
a && moment(a).isValid()
? (b && moment(b).isValid()
? (moment(a).isBefore(b)
? -1
: 1)
: 1)
: -1;
? 1
: -1)
: -1)
: 1;
const Cell = (updatedDate: string) =>
updatedDate