Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JS error #341

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions config/asset_compress.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[crudview.css]
files[]=https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css
files[]=https://cdn.jsdelivr.net/npm/[email protected]/dist/flatpickr.min.css
files[]=https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css
files[]=https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css
files[]=https://cdn.jsdelivr.net/npm/[email protected]/dist/select2-bootstrap-5-theme.min.css
files[]=plugin:CrudView:css/local.css

[crudview_head.js]
files[]=https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
files[]=https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js
files[]=https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js
files[]=https://cdn.jsdelivr.net/npm/[email protected]
files[]=https://cdn.jsdelivr.net/npm/select2@4.0
files[]=https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js
files[]=https://cdn.jsdelivr.net/npm/[email protected]/jquery.dirtyforms.min.js

[crudview.js]
Expand Down
20 changes: 4 additions & 16 deletions webroot/js/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var CrudView = {
select2: function (selector) {
$(selector).each(function () {
var $this = $(this),
config = {theme: 'bootstrap4'};
config = {theme: 'bootstrap-5'};

if (!$this.prop('multiple') && $this.find('option:first').val() === '') {
config.allowClear = true;
Expand All @@ -36,7 +36,7 @@ var CrudView = {
var $ele = $(ele);

$ele.select2({
theme: 'bootstrap4',
theme: 'bootstrap-5',
minimumInputLength: 1,
ajax: {
delay: 250,
Expand Down Expand Up @@ -82,20 +82,9 @@ var CrudView = {
$('form[data-dirty-check=1]').dirtyForms();
},

dropdown: function () {
$('.dropdown-toggle').dropdown();

// recommended hack to get dropdowns correctly work inside responsive table
$('.table-responsive').on('show.bs.dropdown', function () {
$('.table-responsive').css( "overflow", "inherit" );
});
$('.table-responsive').on('hide.bs.dropdown', function () {
$('.table-responsive').css( "overflow", "auto" );
})
},

tooltip: function () {
$('[data-toggle="tooltip"]').tooltip();
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl));
},

initialize: function () {
Expand All @@ -104,7 +93,6 @@ var CrudView = {
this.select2('select[multiple]:not(.no-select2), select.select2');
this.autocomplete('input.autocomplete, select.autocomplete');
this.dirtyForms();
this.dropdown();
this.tooltip();
}
};
Expand Down