#13332 fixed csv export in datatable preload

This commit is contained in:
Daniel Cebrian 2024-04-04 11:27:16 +02:00
parent 8788160d81
commit 58b0cf39dd
4 changed files with 14 additions and 5 deletions

View File

@ -4283,6 +4283,12 @@ function ui_print_datatable(array $parameters)
$js = '<script>'; $js = '<script>';
$js .= 'var dt = '.$json_data.';'; $js .= 'var dt = '.$json_data.';';
$js .= 'var config = '.$json_config.';'; $js .= 'var config = '.$json_config.';';
if (isset($parameters['data_element']) === true) {
$js .= 'var preload_elements = true;';
} else {
$js .= 'var preload_elements = false;';
}
$js .= '</script>'; $js .= '</script>';
$js .= '<script>'; $js .= '<script>';

View File

@ -1,4 +1,4 @@
/* global $ */ /* global $, preload_elements */
var dt = dt; var dt = dt;
var config = config; var config = config;
@ -420,8 +420,10 @@ $(document).ready(function() {
$(function() { $(function() {
$(document).on("preInit.dt", function(ev, settings) { $(document).on("preInit.dt", function(ev, settings) {
$(`#${dt.id}_wrapper div.dataTables_length`).hide(); if (preload_elements === false) {
$(`#${dt.id}_wrapper div.dataTables_filter`).hide(); $(`#${dt.id}_wrapper div.dataTables_length`).hide();
$(`#${dt.id}_wrapper div.dt-buttons`).hide(); $(`#${dt.id}_wrapper div.dataTables_filter`).hide();
$(`#${dt.id}_wrapper div.dt-buttons`).hide();
}
}); });
}); });

View File

@ -20,7 +20,7 @@
} }
.dataTables_paginate.paging_simple_numbers { .dataTables_paginate.paging_simple_numbers {
margin: 10px 20px 20px 0px; margin: 20px 20px 20px 0px;
margin-right: 20px !important; margin-right: 20px !important;
} }

View File

@ -1275,6 +1275,7 @@ if ($inventory_module !== 'basic') {
'no_sortable_columns' => [], 'no_sortable_columns' => [],
'data_element' => $data, 'data_element' => $data,
'searching' => true, 'searching' => true,
'dom_elements' => 'rtipB',
'order' => [ 'order' => [
'field' => $columns[0], 'field' => $columns[0],
'direction' => 'asc', 'direction' => 'asc',