Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
831be33
wip
pxpm Oct 11, 2024
3a61e54
wip
pxpm Oct 11, 2024
f8fec3f
Apply fixes from StyleCI
StyleCIBot Oct 11, 2024
c222441
Apply fixes from StyleCI
StyleCIBot Mar 12, 2025
5e59690
wip
pxpm Mar 19, 2025
792da51
wip
pxpm Mar 19, 2025
dd89d3d
wip
pxpm Mar 24, 2025
d8b8d16
Apply fixes from StyleCI
StyleCIBot Mar 24, 2025
f9b3117
wip
pxpm Mar 27, 2025
e6490ab
wip
pxpm Mar 28, 2025
2e58485
wip
pxpm Mar 28, 2025
f1fdd91
wip
pxpm Apr 1, 2025
693849b
Apply fixes from StyleCI
StyleCIBot Apr 1, 2025
861be11
wip
pxpm Apr 4, 2025
7357fc2
wip
pxpm Apr 7, 2025
74c0bab
wip
pxpm Apr 7, 2025
3ffacd9
Apply fixes from StyleCI
StyleCIBot Apr 7, 2025
60dbf9d
wip
pxpm Apr 24, 2025
863f179
Apply fixes from StyleCI
StyleCIBot Apr 24, 2025
49cc789
wip
pxpm May 2, 2025
868c74c
Apply fixes from StyleCI
StyleCIBot May 2, 2025
b255686
wip
pxpm May 2, 2025
6a92d63
wip
pxpm May 2, 2025
9760254
Apply fixes from StyleCI
StyleCIBot May 2, 2025
b246d64
wip
pxpm May 6, 2025
641ce12
wip
pxpm May 7, 2025
e94f20e
wip
pxpm May 8, 2025
5a71915
fix responsive table
pxpm May 12, 2025
f4a0aea
wip
pxpm May 12, 2025
7cc007d
wip
pxpm May 12, 2025
e3b5759
fix pagination
pxpm May 12, 2025
878ac24
wip
pxpm May 20, 2025
dae5da8
wip
pxpm May 21, 2025
2d583e8
Apply fixes from StyleCI
StyleCIBot May 21, 2025
f66a1f1
wip
pxpm May 27, 2025
9806d93
wip
pxpm May 30, 2025
a83d5b6
Apply fixes from StyleCI
StyleCIBot May 30, 2025
7f00a36
wip
pxpm May 30, 2025
cc93c39
Apply fixes from StyleCI
StyleCIBot May 30, 2025
b8f3157
wip
pxpm Jun 4, 2025
c12786c
Apply fixes from StyleCI
StyleCIBot Jun 4, 2025
e77738c
wip
pxpm Jun 4, 2025
70d6d31
Apply fixes from StyleCI
StyleCIBot Jun 4, 2025
801e5e9
add explanatory comments to CrudPanelManager class
tabacitu Jun 5, 2025
277721f
Apply fixes from StyleCI
StyleCIBot Jun 5, 2025
9bb9011
rename datatables_logic to datatable_logic
tabacitu Jun 5, 2025
262a1f0
Merge branch 'datatable-single-component' of https://github.com/Larav…
tabacitu Jun 5, 2025
1b6ba20
fix
pxpm Jun 5, 2025
0a47c05
Apply fixes from StyleCI
StyleCIBot Jun 5, 2025
3b89f24
wip
pxpm Jun 5, 2025
bd958bb
wip
pxpm Jun 6, 2025
762f513
Apply fixes from StyleCI
StyleCIBot Jun 6, 2025
a974b45
Create setup cache class and create the datatable cache class (#5807)
pxpm Jun 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip
  • Loading branch information
pxpm committed May 6, 2025
commit b246d647d644929a43a724d4738b7a644bffc896
87 changes: 70 additions & 17 deletions src/resources/assets/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,22 @@
/* W3C */
}

.dataTables_wrapper > div.table-footer > div:nth-child(1) > div.dt-length {
display: flex;
}

.dataTables_wrapper > div.table-footer > div:nth-child(1) > div.dt-length select {
width: 4rem;
}

.dataTables_wrapper > div.table-footer > div:nth-child(1) > div.dt-length > label{
white-space: nowrap;
}

div.dt-container div.dt-paging ul.pagination {
justify-content: flex-end;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:active {
outline: none;
background-color: #2b2b2b;
Expand Down Expand Up @@ -237,25 +253,58 @@
padding-left: 0.6rem;
}

.dataTables_processing.card {
all: unset;
position: absolute;
background: rgba(255, 255, 255, 0.9);
height: calc(100% - 6px);
width: calc(100% - 20px);
top: 0;
left: 10px;
z-index: 999;
border-radius: 5px;
overflow: hidden;
/* Improved spinner display for DataTables */
.dataTables_processing,
.dt-processing {
background: rgba(255, 255, 255, 0.8) !important;
color: transparent !important; /* Hide any text */
border: none !important;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1) !important;
border-radius: 5px !important;
/* Full table content coverage */
width: 100% !important;
height: 100% !important;
/* Position it to cover the entire table content */
position: absolute !important;
top: 0 !important;
left: 0 !important;
/* Reset transform since we're using top/left 0 */
transform: none !important;
margin: 0 !important;
padding: 0 !important;
z-index: 999 !important;
/* Center the spinner image using flex */
display: flex !important;
justify-content: center !important;
align-items: center !important;
}

.dataTables_processing.card > img {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
/* Make sure the spinner image displays properly */
.dataTables_processing img,
.dt-processing img {
display: block !important;
width: 60px !important;
height: 60px !important;
opacity: 1 !important;
visibility: visible !important;
margin: 0 auto !important;
}

/* Hide any text that might be in the processing element */
.dataTables_processing > *:not(img),
.dt-processing > *:not(img) {
display: none !important;
}

/* Ensure it's hidden when processing is done */
.dataTables_processing:not([style*="block"]),
.dt-processing:not([style*="block"]) {
display: none !important;
}

/* Ensure proper positioning context */
.table-content {
position: relative !important;
}

.dataTables_wrapper table.dataTable .crud_bulk_actions_line_checkbox {
Expand All @@ -270,6 +319,10 @@
display: none !important;
}

.dt-processing.card > div {
display: none !important;
}

.dt-buttons,
.dtr-modal .details-control,
.modal .details-control {
Expand Down
5 changes: 0 additions & 5 deletions src/resources/views/crud/datatable/datatable.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ class="{{ backpack_theme_config('classes.table') ?? 'table table-striped table-h
@endif

@section('after_styles')
{{-- DATA TABLES --}}
@basset('https://cdn.datatables.net/1.13.1/css/dataTables.bootstrap5.min.css')
@basset('https://cdn.datatables.net/fixedheader/3.3.1/css/fixedHeader.dataTables.min.css')
@basset('https://cdn.datatables.net/responsive/2.4.0/css/responsive.dataTables.min.css')

{{-- CRUD LIST CONTENT - crud_list_styles stack --}}
@stack('crud_list_styles')
@endsection
Expand Down
36 changes: 25 additions & 11 deletions src/resources/views/crud/datatable/datatables_logic.blade.php
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this filename singular (datatable_logic instead of plural datatables_logic). So that it matches the component name, and looks like it's a requirement of it (which it is).

Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@
@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(base_path('vendor/backpack/crud/src/resources/assets/css/responsive-modal.css'), false)

@basset("https://cdn.datatables.net/2.1.8/js/dataTables.min.js")
@basset("https://cdn.datatables.net/2.1.8/js/dataTables.bootstrap5.min.js")
@basset("https://cdn.datatables.net/responsive/3.0.3/js/dataTables.responsive.min.js")
@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)

@push('before_styles')
@basset('https://cdn.datatables.net/2.1.8/css/dataTables.bootstrap5.min.css')
@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')
@endpush

<script>
// here we will check if the cached dataTables paginator length is conformable with current paginator settings.
// datatables caches the ajax responses with pageLength in LocalStorage so when changing this
Expand Down Expand Up @@ -232,7 +234,7 @@ functionsToRunOnDataTablesDrawEvent: [],
@if ($crud->getResponsiveTable())
responsive: {
details: {
display: $.fn.dataTable.Responsive.display.modal( {
display: DataTable.Responsive.display.modal( {
header: function ( row ) {
return '';
},
Expand Down Expand Up @@ -326,6 +328,7 @@ functionsToRunOnDataTablesDrawEvent: [],
autoWidth: false,
pageLength: $dtDefaultPageLength,
lengthMenu: $pageLength,
pagingType: "simple_numbers",
/* Disable initial sort */
aaSorting: [],
language: {
Expand All @@ -337,7 +340,7 @@ functionsToRunOnDataTablesDrawEvent: [],
"thousands": "{{ trans('backpack::crud.thousands') }}",
"lengthMenu": "{{ trans('backpack::crud.lengthMenu') }}",
"loadingRecords": "{{ trans('backpack::crud.loadingRecords') }}",
"processing": "<img src='{{ Basset::getUrl('vendor/backpack/crud/src/resources/assets/img/spinner.svg') }}' alt='{{ trans('backpack::crud.processing') }}'>",
"processing": "<img src='{{ Basset::getUrl('vendor/backpack/crud/src/resources/assets/img/spinner.svg') }}' alt='{{ trans('backpack::crud.processing') }}' style='display:block !important;width:60px !important;height:60px !important;'>",
"search": "_INPUT_",
"searchPlaceholder": "{{ trans('backpack::crud.search') }}...",
"zeroRecords": "{{ trans('backpack::crud.zeroRecords') }}",
Expand Down Expand Up @@ -582,7 +585,7 @@ function setupTableUI(tableId, config) {

$(`#${tableId}_wrapper .table-footer .btn-secondary`).removeClass('btn-secondary');

$(".navbar.navbar-filters + div").css('overflow','initial');
$(".navbar.navbar-filters + div").css('overflow','hidden');

if (config.subheading) {
$(`#${tableId}_info`).hide();
Expand Down Expand Up @@ -639,6 +642,17 @@ function setupTableEvents(tableId, config) {

// on DataTable draw event run all functions in the queue
$(`#${tableId}`).on('draw.dt', function() {
console.log('draw event fired for table: ' + tableId);
// in datatables 2.0.3 the implementation was changed to use `replaceChildren`, for that reason scripts
// that came with the response are no longer executed, like the delete button script or any other ajax
// button created by the developer. For that reason, we move them to the end of the body
// ensuring they are re-evaluated on each draw event.
document.getElementById(tableId).querySelectorAll('script').forEach(function(script) {
const newScript = document.createElement('script');
newScript.text = script.text;
document.body.appendChild(newScript);
});

window.crud.defaultTableConfig.functionsToRunOnDataTablesDrawEvent.forEach(function(functionName) {
config.executeFunctionByName(functionName);
});
Expand Down
Loading