I am using the angular-datatable plugin with the following environemnt:
- node version:v11.1.0
- angular version:7.2.4
- angular-cli version:7.3.0
- jquery version:3.3.22
- datatables version:1.10.13
- angular-datatables version:^7.0.0
The HTML is:
<div class="col ">
<table datatable [dtOptions]="dtOptions" class="table table-striped" style="font-size: 0.8rem;">
<thead>
<tr class="text-center">
<th scope="col">Coupon Code</th>
<th scope="col">Coupon State</th>
<th scope="col">Issuance Channel</th>
<th scope="col">Create Date</th>
<th scope="col">Expire Date</th>
<th scope="col">Number Of Redemptions</th>
<th scope="col">Redemptions</th>
</tr>
</thead>
<tbody>
<tr class="text-center" *ngFor="let object of allCoupons">
<td scope="col">{{object.couponCode}}</td>
<td scope="col">{{object.couponState}}</td>
<td scope="col">{{object.channel}}</td>
<td
scope="col">{{object.createDate | date: 'dd/MM/yyyy' }}</td>
<td
scope="col">{{object.expireDate }}</td>
<td scope="col"> {{object.redemptions.length}}</td>
<td>
<div class="btn-group btn-group-sm w-100">
<button type="button" class="w-100 btn btn-light fas fa-list-alt "
title="See Redemptions"
(click)="openRedeemModal(content,object.redemptions)">
</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
And the dtOptions
are:
dtOptions: DataTables.Settings = {};
ngOnInit() {
this.dtOptions = {
columnDefs: [
{ targets: 3, type: 'date' }
]
};
}
However the result is not sorting via the date as you can see in the demo:
https://angular-datatables-gitter-smpc8z.stackblitz.io
I cannot find of another way to correct the issue and I have tried everything I found online.