SUPPORT-9533: sort fix
This commit is contained in:
parent
1609e3137e
commit
8b8be81bf3
1 changed files with 16 additions and 2 deletions
|
|
@ -5,7 +5,7 @@ import {
|
|||
SuppressKeyboardEventParams
|
||||
} from "ag-grid-community";
|
||||
import {
|
||||
DateTimeUtil,
|
||||
ComparisonUtils,
|
||||
DefaultTooltip,
|
||||
GridCellTooltipUtils,
|
||||
GridColumnComparatorUtils,
|
||||
|
|
@ -54,7 +54,12 @@ export class StaticColumnInitializer {
|
|||
|
||||
if (type != null) {
|
||||
if (gridRef.getRowModelType() == "clientSide") {
|
||||
columnDef.comparator = GridColumnComparatorUtils.columnComparator(type);
|
||||
if (type === 'java.time.ZonedDateTime') {
|
||||
columnDef.comparator = StaticColumnInitializer.zonedDateTimeComparator();
|
||||
}
|
||||
else {
|
||||
columnDef.comparator = GridColumnComparatorUtils.columnComparator(type);
|
||||
}
|
||||
}
|
||||
columnDef.valueFormatter = GridValueFormatterUtils.columnFormatter(type);
|
||||
columnDef.cellRenderer = gridRef.createRenderer(column);
|
||||
|
|
@ -118,4 +123,13 @@ export class StaticColumnInitializer {
|
|||
|
||||
return columnDef;
|
||||
}
|
||||
|
||||
private static zonedDateTimeComparator(): (valueA: any, valueB: any) => number {
|
||||
return (valueA: any, valueB: any) => {
|
||||
const format = 'DD.MM.YYYY HH:mm:ss (Z)';
|
||||
const momentA = moment(valueA, format);
|
||||
const momentB = moment(valueB, format);
|
||||
return ComparisonUtils.momentCompare(momentA, momentB);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue