js
1. import euro-date.js
2.
app.controller('pid03_ctrl', function($scope, $http, $interval, DTOptionsBuilder,DTColumnBuilder, DTColumnDefBuilder)
3.
$scope.dtOptions = DTOptionsBuilder.newOptions() //angular-datatable
.withPaginationType('full_numbers')
.withDisplayLength(5)
.withOption('order', [0, 'desc']);
$scope.dtColumnDefs = [
DTColumnDefBuilder.newColumnDef([0,4])
.withOption('type', 'date-euro')
];
html
<table id="action_list" datatable="ng" dt-options="dtOptions"
dt-columns="dtColumns" dt-instance="dtInstance"
class="table table-bordered table-striped table-hover" dt-column-defs="dtColumnDefs">
<thead>
<th>Action Date Time</th>
<th>Action Code</th>
<th>Remarks</th>
<th>Created By</th>
<th>Next Review</th>
</thead>
<tbody>
<tr ng-repeat="i in customer.activity_set" ng-cloak>
<td>
<a href="{% url 'main:pid19'%}[[i.id]]" target="_blank">
[[i.created| date: "dd/MM/y H:mm:ss" ]]
</td>
<td>[[i.action_text]]</a></td>
<td>[[i.memo]]</td>
<td>[[i.action_by]]</td>
<td>[[i.review_date | date: "dd/MM/y H:mm:ss" ]]</td>
</tr>
</tbody>
</table>
ref
https://forums.asp.net/t/2095474.aspx?Angularjs+Datatable+Ordering+not+working+for+DateTime+dd+MM+yyyy+HH+mm
http://stackoverflow.com/questions/34926231/angular-datatables-wrong-sorting-on-date
No comments:
Post a Comment