Created
May 19, 2017 14:19
-
-
Save qt91/9a8dc92088fc8d48ce33b7a49ed288d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.dataTable = $this.dtOptions = $this.DTOptionsBuilder.newOptions() | |
.withOption('ajax', { | |
url :'order/datatables', | |
type:'GET', | |
data:function(data){ | |
if(angular.isDate($this.date.start)){ | |
data.date_start = $this.$filter('date')($this.date.start, "yyyy-MM-dd 00:00:00"); | |
} | |
if(angular.isDate($this.date.end)){ | |
data.date_end = $this.$filter('date')($this.date.end, "yyyy-MM-dd 23:59:99"); | |
} | |
} | |
}) | |
// or here | |
.withBootstrap() | |
.withLanguage(language) | |
.withDataProp('data') | |
.withOption('processing', true) | |
.withOption('serverSide', true) | |
.withOption('order', [0, 'desc']) | |
.withOption('fnRowCallback', rowCallback) | |
.withPaginationType('full_numbers'); | |
$this.dtColumns = [ | |
$this.DTColumnBuilder.newColumn('id').withTitle('#'), | |
$this.DTColumnBuilder.newColumn('code').withTitle('Mã'), | |
$this.DTColumnBuilder.newColumn('name').withTitle('Tên'), | |
$this.DTColumnBuilder.newColumn('user.name').withTitle('Người tạo'), | |
$this.DTColumnBuilder.newColumn('customer.fullname').withTitle('Khách hàng'), | |
$this.DTColumnBuilder.newColumn('total').withTitle('Tổng tiền').renderWith(function(data, type){ | |
return '<p class="text-center">' + $this.$filter('number')(data, '0') + '</p>'; | |
}), | |
$this.DTColumnBuilder.newColumn('created_at').withTitle('Ngày tạo'), | |
$this.DTColumnBuilder.newColumn('state').withTitle('Trạng thái').renderWith(function(data, type){ | |
return '<p class="text-center">' + data + '</p>'; | |
}), | |
$this.DTColumnBuilder.newColumn('action').withTitle('Tùy chọn').withOption('searchable', false) | |
]; | |
function rowCallback(nRow, aData, iDisplayIndex, iDisplayIndexFull){ | |
$this.$compile(nRow)($this.$scope); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment