mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
fix Maintainers column sort
This commit is contained in:
parent
756922f321
commit
cef7554fb0
1 changed files with 15 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ export const Maintainers = (columnVisibility: IColumnVisibility[], maintainers:
|
|||
filterable: true,
|
||||
filterMethod: (f: Filter, r: any[]) => filterMethod(f, r, maintainers),
|
||||
Filter: ({ filter, onChange }: any) => Filter({ onChange, filter }, maintainers),
|
||||
sortMethod: (a: number[], b: number[]) => sortMethod(a, b, maintainers),
|
||||
Cell: (c: any) => Cell(c.value, maintainers),
|
||||
width: 140,
|
||||
headerClassName: "d-none d-md-block",
|
||||
|
|
@ -43,6 +44,20 @@ const Filter = (props: any, maintainers: IMaintainer[]) =>
|
|||
: null}
|
||||
</select>;
|
||||
|
||||
const sortMethod = (a: number[], b: number[], maintainers: IMaintainer[]) => {
|
||||
if (a && a.length > 0) {
|
||||
if (b && b.length > 0) {
|
||||
const aFirstMaintainerName = maintainers.filter((m: IMaintainer) => m.id === a[0])[0].name;
|
||||
const bFirstMaintainerName = maintainers.filter((m: IMaintainer) => m.id === b[0])[0].name;
|
||||
return aFirstMaintainerName.toLowerCase() > bFirstMaintainerName.toLowerCase() ? 1 : -1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
const Cell = (maintainerIds: number[], maintainers: IMaintainer[]) =>
|
||||
maintainerIds
|
||||
? <div className="fl-tag-container">
|
||||
|
|
|
|||
Loading…
Reference in a new issue