I am using Jquery datatable specially yajra datatable for laravel. But when I run the app, the datatable pagination buttons is distorted. I added a custom button in order for me to customize a button functions. If anyone know how to fix please help. Thanks.
Here is my code for specific datatable
JavaScript
x
99
99
1
function load_for_reevaluation (){
2
window.INVDT = $('#tbl-client-for_reevaluation').DataTable({
3
//processing: true,
4
"dom": 'lBfrtip',
5
serverSide: true,
6
"fnInitComplete": function (oSettings, json) {
7
toastr.options.progressBar = true;
8
$('#loading').hide();
9
},
10
"autoWidth": false,
11
"lengthMenu": [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
12
"iDisplayLength": 6,
13
14
ajax: {
15
"url": "{{ route('admin.clients.show-client-returns', $client->id) }}",
16
"dataSrc": function ( json ) {
17
return json.data.filter(function(item){
18
return item.for_reevaluation_qty != null
19
});
20
}
21
},
22
23
buttons:{
24
buttons:[
25
{
26
extend: 'copy',
27
className: 'btn buttons-csv buttons-html5 btn-default',
28
text: 'Copy',
29
30
},
31
{
32
extend: 'csv',
33
className: 'btn buttons-csv buttons-html5 btn-default',
34
text: 'CSV',
35
},
36
{
37
extend: 'pdf',
38
className: 'btn buttons-csv buttons-html5 btn-default',
39
text: 'PDF',
40
},
41
{
42
extend: 'print',
43
className: 'btn buttons-csv buttons-html5 btn-default',
44
text: 'Print',
45
},
46
{
47
extend: 'colvis',
48
className: 'btn buttons-csv buttons-html5 btn-default',
49
text: 'Column Visibility',
50
},
51
{
52
text: 'Copy for Case Filing',
53
className: 'btn buttons-csv buttons-html5 btn-info',
54
action: function(){
55
console.log('hello')
56
}
57
}
58
59
],
60
dom:{
61
button:{
62
className:'btn btn-primary'
63
}
64
}
65
},
66
columns: [
67
{
68
data: {}, name: 'client', "class": "text-nowrap text-center", render: function (data) {
69
return `<span class=''>`+(data.client ? data.client : '')+"</span>";
70
}
71
},
72
{
73
data: {}, name: 'amazon_order_id', "class": "text-nowrap text-center", render: function (data) {
74
return `<span class="jc-order-id">`+(data.amazon_order_id ? data.amazon_order_id : '')+`</span>`;
75
}
76
},
77
{
78
data: {}, name: 'refunded', "class": "text-nowrap text-center", render: function (data) {
79
return `<span>`+(data.refunded ? data.refunded : '')+`</span>`;
80
}
81
},
82
{
83
data: {}, name: 'goodwill_amount', "class": "text-nowrap text-center", render: function (data) {
84
return `
85
$<span class="jc-never-returned-amount-reimbursable">`+(data.nr_amount_reimbursable!='0.00' ? data.nr_amount_reimbursable : '')+`</span>
86
<span class="jc-incorrect-fnsku-amount-reimbursable">`+(data.incorrect_fnsku_qty > 0 ? data.if_amount_reimbursable : '')+`</span>
87
<span class="jc-goodwill-amount-reimbursable">`+(data.goodwill_amount!='0.00' ? data.goodwill_amount : '')+`</span>
88
<span class="jc-fr-amount-reimbursable">`+(data.fr_amount_reimbursable!='0.00' ? data.fr_amount_reimbursable : '')+`</span>
89
<span class="jc-fr-fnsku" style="display:none">`+(data.fr_fnsku!=null ? data.fr_fnsku : '')+`</span>
90
<span class="jc-fr-reimbursement-id" style="display:none">`+(data.fr_reimbursement_id!=null ? data.fr_reimbursement_id : '')+`</span>
91
<span class="jc-fr-expected-reimbursable-amount" style="display:none">`+(data.fr_amount_reimbursable!='0.00' ? data.fr_amount_reimbursable : '')+`</span>
92
<span class="jc-fr-amount-received" style="display:none">`+(data.umr_amount_total!='0.00' ? data.umr_amount_total : '')+`</span>
93
<span class="jc-fr-discrepancy" style="display:none">`+(data.fr_amount_reimbursable!='0.00' ? data.fr_amount_reimbursable : '')+`</span>`;
94
}
95
},
96
]
97
});
98
}
99
Advertisement
Answer
I have experienced that issue before. just override the css class name of jquery datatables. Try this code, maybe it can help.
JavaScript
1
12
12
1
<style>
2
.dataTables_wrapper .dataTables_paginate .paginate_button {
3
padding : 0px;
4
margin-left: 0px;
5
display: inline;
6
border: 0px;
7
}
8
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
9
border: 0px;
10
}
11
</style>
12