Tôi đang cố gắng để làm cho Angularjs DataTable phía máy chủ pagination trong liên kết này https://l-lin.github.io/angular-datatables/#/serverSideProcessingAngularjs DataTable phía máy chủ pagination
Vì vậy, tôi sử dụng mã này
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withOption('ajax', {
dataSrc: function(json) {
conole.log(json)
json['recordsTotal'] =json.length
json['recordsFiltered'] = json.length
json['draw']=1
conole.log(json)
return json;
},
url: 'api/footestrecords',
type: 'GET'
})
.withOption('processing', true)
.withOption('serverSide', true)
.withPaginationType('full_numbers');
tôi thêm recordsTotal, recordsFiltered và hàng bằng tay trong tham số dataSrc
và đây là dữ liệu json trước và sau khi thêm recordsTotal, recordsFiltered và hàng dữ liệu
json trước khi thêm
[Object, Object, Object, Object, Object, Object, Object, Object,
Object,Object, Object, Object, Object, Object, Object, Object, Object,
Object, Object, Object, Object, Object, Object, Object, Object, Object,
Object, Object]
json dữ liệu sau khi thêm
[Object, Object, Object, Object, Object, Object, Object, Object,
Object, Object, Object, Object, Object, Object, Object, Object, Object,
Object, Object, Object, Object, Object, Object, Object, Object,
Object,Object, Object, recordsTotal: 28, recordsFiltered: 28, draw: 1]
các probelm là pagination không làm việc, bảng dữ liệu cho thấy tất cả dữ liệu trong một trang, và khi tôi bấm vào nút phân trang đã không có hành động.
định dạng
bạn có thể khắc phục không? –
Bạn đã thực hiện lỗi ở đây: 'conole.log' – zygimantus