[Tables] Use parsed data to sort (#2785)

* Use parsed values when sorting
This commit is contained in:
Deep Tailor 2020-03-30 16:57:20 -07:00 committed by GitHub
parent a5326a7b95
commit 87d838c690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View File

@ -56,6 +56,10 @@ define(function () {
return formattedValue;
}
}
getParsedValue(telemetryDatum) {
return this.formatter.parse(telemetryDatum);
}
}
return TelemetryTableColumn;

View File

@ -42,6 +42,11 @@ define([], function () {
return column && column.getFormattedValue(this.datum[key]);
}
getParsedValue(key) {
let column = this.columns[key];
return column && column.getParsedValue(this.datum[key]);
}
getCellComponentName(key) {
let column = this.columns[key];
return column &&

View File

@ -201,7 +201,7 @@ define(
sortBy(sortOptions) {
if (arguments.length > 0) {
this.sortOptions = sortOptions;
this.rows = _.sortByOrder(this.rows, 'datum.' + sortOptions.key, sortOptions.direction);
this.rows = _.sortByOrder(this.rows, (row) => row.getParsedValue(sortOptions.key) , sortOptions.direction);
this.emit('sort');
}
// Return duplicate to avoid direct modification of underlying object
@ -222,7 +222,7 @@ define(
}
getValueForSortColumn(row) {
return row.datum[this.sortOptions.key];
return row.getParsedValue(this.sortOptions.key);
}
remove(removedRows) {