From 9654ff8e6a168e9a1f146a18111f832807105a51 Mon Sep 17 00:00:00 2001 From: pxpm Date: Mon, 25 Nov 2024 12:55:02 +0000 Subject: [PATCH 1/8] update datatables --- .../views/crud/inc/datatables_logic.blade.php | 16 +++++++++------- .../views/crud/inc/export_buttons.blade.php | 11 +++++------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/resources/views/crud/inc/datatables_logic.blade.php b/src/resources/views/crud/inc/datatables_logic.blade.php index 7e4ce13504..8b8a003cb0 100644 --- a/src/resources/views/crud/inc/datatables_logic.blade.php +++ b/src/resources/views/crud/inc/datatables_logic.blade.php @@ -6,12 +6,12 @@ @endphp {{-- DATA TABLES SCRIPT --}} - @basset('https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js') - @basset('https://cdn.datatables.net/1.13.1/js/dataTables.bootstrap5.min.js') - @basset('https://cdn.datatables.net/responsive/2.4.0/js/dataTables.responsive.min.js') - @basset('https://cdn.datatables.net/responsive/2.4.0/css/responsive.dataTables.min.css') - @basset('https://cdn.datatables.net/fixedheader/3.3.1/js/dataTables.fixedHeader.min.js') - @basset('https://cdn.datatables.net/fixedheader/3.3.1/css/fixedHeader.dataTables.min.css') +@basset("https://cdn.datatables.net/2.1.8/js/dataTables.js") +@basset("https://cdn.datatables.net/2.1.8/css/dataTables.dataTables.css") +@basset("https://cdn.datatables.net/responsive/3.0.3/js/dataTables.responsive.min.js") +@basset("https://cdn.datatables.net/responsive/3.0.3/css/responsive.dataTables.min.css") + @basset('https://cdn.datatables.net/fixedheader/4.0.1/css/fixedHeader.dataTables.min.css') + @basset('https://cdn.datatables.net/fixedheader/4.0.1/js/dataTables.fixedHeader.min.js') @basset(base_path('vendor/backpack/crud/src/resources/assets/img/spinner.svg'), false) @@ -147,7 +147,7 @@ functionsToRunOnDataTablesDrawEvent: [], @if ($crud->getResponsiveTable()) responsive: { details: { - display: $.fn.dataTable.Responsive.display.modal( { + display: DataTable.Responsive.display.modal( { header: function ( row ) { // show the content of the first column // as the modal header @@ -360,6 +360,7 @@ functionsToRunOnDataTablesDrawEvent: [], // on DataTable draw event run all functions in the queue // (eg. delete and details_row buttons add functions to this queue) $('#crudTable').on( 'draw.dt', function () { + console.log('draw.dt'); crud.functionsToRunOnDataTablesDrawEvent.forEach(function(functionName) { crud.executeFunctionByName(functionName); }); @@ -390,6 +391,7 @@ functionsToRunOnDataTablesDrawEvent: [], // when columns are hidden by reponsive plugin, // the table should have the has-hidden-columns class crud.table.on( 'responsive-resize', function ( e, datatable, columns ) { + console.log('responsive-resize', crud.table.responsive.hasHidden()); if (crud.table.responsive.hasHidden()) { $('.dtr-control').removeClass('d-none'); $('.dtr-control').addClass('d-inline'); diff --git a/src/resources/views/crud/inc/export_buttons.blade.php b/src/resources/views/crud/inc/export_buttons.blade.php index 8c8bd9a154..fe92da9db1 100644 --- a/src/resources/views/crud/inc/export_buttons.blade.php +++ b/src/resources/views/crud/inc/export_buttons.blade.php @@ -1,13 +1,12 @@ @if ($crud->exportButtons()) - @basset('https://cdn.datatables.net/buttons/2.3.3/css/buttons.bootstrap5.min.css') - @basset('https://cdn.datatables.net/buttons/2.3.3/js/dataTables.buttons.min.js') - @basset('https://cdn.datatables.net/buttons/2.3.3/js/buttons.bootstrap5.min.js') + @basset('https://cdn.datatables.net/buttons/3.2.0/css/buttons.dataTables.min.css') + @basset('https://cdn.datatables.net/buttons/3.2.0/js/dataTables.buttons.min.js') @basset('https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js') @basset('https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.18/pdfmake.min.js') @basset('https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.18/vfs_fonts.js') - @basset('https://cdn.datatables.net/buttons/2.3.2/js/buttons.html5.min.js') - @basset('https://cdn.datatables.net/buttons/2.3.2/js/buttons.print.min.js') - @basset('https://cdn.datatables.net/buttons/2.3.2/js/buttons.colVis.min.js') + @basset('https://cdn.datatables.net/buttons/3.2.0/js/buttons.html5.min.js') + @basset('https://cdn.datatables.net/buttons/3.2.0/js/buttons.print.min.js') + @basset('https://cdn.datatables.net/buttons/3.2.0/js/buttons.colVis.min.js') - + @include('crud::inc.details_row_logic') +@endpush \ No newline at end of file diff --git a/src/resources/views/crud/inc/export_buttons.blade.php b/src/resources/views/crud/inc/export_buttons.blade.php index 0de3f941be..e731323964 100644 --- a/src/resources/views/crud/inc/export_buttons.blade.php +++ b/src/resources/views/crud/inc/export_buttons.blade.php @@ -1,13 +1,17 @@ @if ($crud->exportButtons()) - @basset('https://cdn.datatables.net/buttons/3.2.0/css/buttons.dataTables.min.css') - @basset('https://cdn.datatables.net/buttons/3.2.0/js/dataTables.buttons.min.js') - @basset('https://cdn.datatables.net/buttons/3.2.0/js/buttons.bootstrap5.min.js') - @basset('https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js') - @basset('https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.18/pdfmake.min.js') - @basset('https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.18/vfs_fonts.js') - @basset('https://cdn.datatables.net/buttons/3.2.0/js/buttons.html5.min.js') - @basset('https://cdn.datatables.net/buttons/3.2.0/js/buttons.print.min.js') - @basset('https://cdn.datatables.net/buttons/3.2.0/js/buttons.colVis.min.js') + @push('after_scripts') + @basset('https://cdn.datatables.net/buttons/3.2.0/js/dataTables.buttons.min.js') + @basset('https://cdn.datatables.net/buttons/3.2.0/js/buttons.bootstrap5.min.js') + @basset('https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js') + @basset('https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.18/pdfmake.min.js') + @basset('https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.18/vfs_fonts.js') + @basset('https://cdn.datatables.net/buttons/3.2.0/js/buttons.html5.min.js') + @basset('https://cdn.datatables.net/buttons/3.2.0/js/buttons.print.min.js') + @basset('https://cdn.datatables.net/buttons/3.2.0/js/buttons.colVis.min.js') + @endpush + @push('after_styles') + @basset('https://cdn.datatables.net/buttons/3.2.0/css/buttons.bootstrap5.min.css') + @endpush