Enhancement loan transactions tab for sort and pagination (#1658)
Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
co-authored by
Jose Alberto Hernandez
parent
a04f426c83
commit
480809c4cc
+6
-4
@@ -12,15 +12,15 @@
|
||||
|
||||
<div class="mat-elevation-z1 m-b-25">
|
||||
|
||||
<table mat-table [dataSource]="dataSource" >
|
||||
<table mat-table [dataSource]="dataSource" matSort>
|
||||
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef> ID </th>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Id </th>
|
||||
<td mat-cell *matCellDef="let transaction"> {{ transaction.id }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="transactionDate">
|
||||
<th mat-header-cell class="center" *matHeaderCellDef> Transaction Date </th>
|
||||
<ng-container matColumnDef="date">
|
||||
<th mat-header-cell class="center" *matHeaderCellDef mat-sort-header> Transaction Date </th>
|
||||
<td mat-cell *matCellDef="let transaction"> {{ transaction.date | dateFormat }} </td>
|
||||
</ng-container>
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
|
||||
</table>
|
||||
|
||||
<mat-paginator [pageSize]="50" [pageSizeOptions]="[50, 100, 200]" showFirstLastButtons></mat-paginator>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
@@ -21,6 +23,8 @@ export class TransactionsTabComponent implements OnInit {
|
||||
displayedColumns: string[] = ['id', 'transactionDate', 'transactionType', 'debit', 'credit', 'balance', 'viewReciept'];
|
||||
/** Data source for transactions table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
@ViewChild(MatSort, { static: true }) sort: MatSort;
|
||||
|
||||
/**
|
||||
* Retrieves savings account data from `resolve`.
|
||||
@@ -36,6 +40,8 @@ export class TransactionsTabComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.dataSource = new MatTableDataSource(this.transactionsData);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user