Datatable views updates for display values with format (#1603)
Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
co-authored by
Jose Alberto Hernandez
parent
eae1b350b7
commit
7bbab6423e
@@ -16,6 +16,9 @@ import { GroupsService } from '../../../groups.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { Datatables } from 'app/core/utils/datatables';
|
||||
import { DateFormatPipe } from 'app/pipes/date-format.pipe';
|
||||
import { DatetimeFormatPipe } from 'app/pipes/datetime-format.pipe';
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
|
||||
/**
|
||||
* Group Multi Row Data Tables
|
||||
@@ -58,7 +61,10 @@ export class MultiRowComponent implements OnInit, OnChanges {
|
||||
private groupsService: GroupsService,
|
||||
private dialog: MatDialog,
|
||||
private settingsService: SettingsService,
|
||||
private datatables: Datatables) {
|
||||
private datatables: Datatables,
|
||||
private dateFormat: DateFormatPipe,
|
||||
private dateTimeFormat: DatetimeFormatPipe,
|
||||
private numberFormat: DecimalPipe) {
|
||||
this.groupId = this.route.parent.parent.snapshot.paramMap.get('groupId');
|
||||
}
|
||||
|
||||
@@ -134,4 +140,16 @@ export class MultiRowComponent implements OnInit, OnChanges {
|
||||
});
|
||||
}
|
||||
|
||||
formatValue(index: number, value: any): any {
|
||||
const columnDisplayType = this.dataObject.columnHeaders[index].columnDisplayType;
|
||||
if (columnDisplayType === 'DATE') {
|
||||
return this.dateFormat.transform(value);
|
||||
} else if (columnDisplayType === 'DATETIME') {
|
||||
return this.dateTimeFormat.transform(value);
|
||||
} else if (columnDisplayType === 'INTEGER' || columnDisplayType === 'DECIMAL') {
|
||||
return this.numberFormat.transform(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user