+ Remove white space when export to excel
This commit is contained in:
parent
31ac8e45d5
commit
890ff5c0e5
|
@ -200,6 +200,19 @@
|
|||
'pageLength',
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
customizeData: function (data) {
|
||||
for (var i = 0; i < data.body.length; i++) {
|
||||
for (var j = 0; j < data.body[i].length; j++) {
|
||||
// data.body[i][j] = '\u200C' + data.body[i][j];
|
||||
if ([1, 2].includes(j)) {
|
||||
// Get the value and strip the non numeric characters
|
||||
// var value = $(this).text();
|
||||
value = data.body[i][j].replace(',', ".")
|
||||
data.body[i][j] = Number(value.replace(/[^0-9\.-]+/g, ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
customize: function (xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'],
|
||||
sum = 0;
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
<div class="col-xs-12">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php echo $this->lang->line('recharge_historic'); ?></h3>
|
||||
<h3 class="box-title"><?php echo $this->lang->line('refund_history'); ?></h3>
|
||||
</div>
|
||||
<div class="box-body" style="overflow-x:auto;">
|
||||
<?php
|
||||
|
|
|
@ -266,7 +266,7 @@ use Brick\Money\Money;
|
|||
"aaSorting": [[ 17, "desc" ]],
|
||||
"columnDefs": [ {
|
||||
targets: 17,
|
||||
render: $.fn.dataTable.render.moment( 'YYYY-MM-DD HH:mm:ss' , 'D MMMM YYYY HH:mm:ss', format)
|
||||
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
|
||||
}],
|
||||
dom: 'Bfrtip',
|
||||
"buttons": [
|
||||
|
@ -275,15 +275,30 @@ use Brick\Money\Money;
|
|||
extend: 'excelHtml5',
|
||||
title: 'Histrotique des transactions',
|
||||
exportOptions: {
|
||||
columns: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]
|
||||
}
|
||||
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
|
||||
},
|
||||
customizeData: function (data) {
|
||||
for (var i = 0; i < data.body.length; i++) {
|
||||
for (var j = 0; j < data.body[i].length; j++) {
|
||||
// data.body[i][j] = '\u200C' + data.body[i][j];
|
||||
if ([3, 4, 7, 8, 9, 10, 11, 12, 13].includes(j)) {
|
||||
// Get the value and strip the non numeric characters
|
||||
// var value = $(this).text();
|
||||
value = data.body[i][j].replace(',', ".")
|
||||
data.body[i][j] = Number(value.replace(/[^0-9\.-]+/g, ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
trim: false
|
||||
},
|
||||
{
|
||||
extend: 'csvHtml5',
|
||||
title: 'Histrotique des transactions',
|
||||
exportOptions: {
|
||||
columns: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]
|
||||
}
|
||||
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
|
||||
},
|
||||
trim: false
|
||||
},
|
||||
{
|
||||
extend: 'pdfHtml5',
|
||||
|
@ -291,15 +306,16 @@ use Brick\Money\Money;
|
|||
pageSize: 'LEGAL',
|
||||
title: 'Histrotique des transactions',
|
||||
exportOptions: {
|
||||
columns: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]
|
||||
}
|
||||
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
|
||||
},
|
||||
trim: false
|
||||
},
|
||||
// 'colvis'
|
||||
]
|
||||
});
|
||||
|
||||
table.buttons().container()
|
||||
.appendTo( '#example_wrapper .col-sm-6:eq(0)' );
|
||||
.appendTo('#example_wrapper .col-sm-6:eq(0)');
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue