Skip to content

Commit

Permalink
Fix: fisharebest#4964 - upgrade datatables to V2
Browse files Browse the repository at this point in the history
  • Loading branch information
fisharebest authored and ddrury committed Nov 25, 2024
1 parent 85e9129 commit de60286
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 26 deletions.
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"beautifymarker": "1.0.9",
"bootstrap": "5.3.3",
"corejs-typeahead": "1.3.4",
"datatables.net": "1.13.11",
"datatables.net-bs5": "1.13.11",
"datatables.net": "2.1.8",
"datatables.net-bs5": "2.1.8",
"dejavu-fonts-ttf": "2.37.3",
"hideshowpassword": "2.2.0",
"jquery": "3.7.1",
Expand Down
4 changes: 2 additions & 2 deletions public/css/vendor.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/vendor.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/webtrees.min.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions resources/css/_vendor-patches.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,13 @@
[dir=rtl] .carousel-control-prev-icon {
transform: scale(-1, 1);
}

/* Some themes set the global default to separate. We should change this. */
table.datatables {
border-collapse: collapse;
}

/* Don't right-align column headings of numeric data. */
table.datatables > thead > tr > th.dt-type-numeric {
text-align: inherit;
}
4 changes: 2 additions & 2 deletions resources/js/vendor.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ window.bootstrap = {
Tooltip: Tooltip,
};

import 'datatables.net';

// Just import the subset of icons that we use in resources/views/icons/
import { dom, library } from '@fortawesome/fontawesome-svg-core';
import {
Expand All @@ -56,7 +54,9 @@ import {
} from '@fortawesome/free-solid-svg-icons';
import 'corejs-typeahead';

import DataTable from 'datatables.net';
import 'datatables.net-bs5';
window.DataTable = DataTable;

import Sortable from 'sortablejs';

Expand Down
6 changes: 3 additions & 3 deletions resources/js/webtrees.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,9 +941,9 @@ $(function () {
};

// DataTables - start hidden to prevent FOUC.
$('table.datatables').each(function () {
$(this).DataTable();
$(this).removeClass('d-none');
document.querySelectorAll('table.datatables').forEach(function (element) {
new DataTable(element);
element.classList.remove('d-none');
});

// Save button/checkbox state between pages
Expand Down
2 changes: 1 addition & 1 deletion resources/views/lists/datatables-attributes.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use Fisharebest\Webtrees\I18N;
?>

data-auto-width="false"
data-dom="<&quot;d-flex justify-content-between&quot;pf><t><&quot;d-flex justify-content-between&quot;irl>"
data-layout="<?= e(json_encode(['topStart' => 'paging', 'topEnd' => 'search', 'bottomStart' => 'info', 'bottomEnd' => 'pageLength'], JSON_THROW_ON_ERROR)) ?>"
data-state-save="true"
data-length-menu="<?= e(json_encode([[10, 20, 50, 100, 500, 1000, -1], [I18N::number(10), I18N::number(20), I18N::number(50), I18N::number(100), I18N::number(500), I18N::number(1000), I18N::translate('All')]], JSON_THROW_ON_ERROR)) ?>"
data-language="<?= e(json_encode([
Expand Down

0 comments on commit de60286

Please sign in to comment.