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
+19
-1
@@ -20,6 +20,9 @@ import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicke
|
||||
import { SavingsService } from '../../../savings.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';
|
||||
|
||||
/**
|
||||
* Savings Account Multi Row Data Tables
|
||||
@@ -62,7 +65,10 @@ export class MultiRowComponent implements OnInit, OnChanges {
|
||||
private savingsService: SavingsService,
|
||||
private dialog: MatDialog,
|
||||
private settingsService: SettingsService,
|
||||
private datatables: Datatables) {
|
||||
private datatables: Datatables,
|
||||
private dateFormat: DateFormatPipe,
|
||||
private dateTimeFormat: DatetimeFormatPipe,
|
||||
private numberFormat: DecimalPipe) {
|
||||
this.savingAccountId = this.route.parent.parent.snapshot.paramMap.get('savingAccountId');
|
||||
}
|
||||
|
||||
@@ -138,4 +144,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