fix table limit

This commit is contained in:
vedatakd 2022-02-03 18:22:19 +03:00
parent 6fbe43a444
commit 00072a9bc3

View File

@ -5,7 +5,7 @@ let initModal = function () {
let loading = '<div class="modal-loading"><div class="active loader large"></div></div>'; let loading = '<div class="modal-loading"><div class="active loader large"></div></div>';
// Loading state // Loading state
modal.on('loading', function() { modal.on('loading', function () {
$(this).find('.modal-content').append(loading); $(this).find('.modal-content').append(loading);
}); });
@ -36,6 +36,25 @@ let initModal = function () {
}); });
}); });
// Remove onchange event in ajax select field
if ($('.table--ajax').find('.table-limit').length > 0) {
$('.table--ajax').find('.table-limit').removeAttr("onchange");
}
// Handle ajax select in modals.
$('.table--ajax .table-limit').on('change', function (e) {
e.preventDefault();
let wrapper = $(this).closest('.modal-content');
wrapper.append(loading);
$.get($(this).val(), function (html) {
wrapper.html(html);
});
});
// Handle ajax forms in modals. // Handle ajax forms in modals.
modal.on('submit', 'form.ajax', function (e) { modal.on('submit', 'form.ajax', function (e) {
@ -79,7 +98,7 @@ $(document).ajaxComplete(function () {
$(document).on('show.bs.modal', '.modal', function () { $(document).on('show.bs.modal', '.modal', function () {
let zIndex = 1040 + (10 * $('.modal:visible').length); let zIndex = 1040 + (10 * $('.modal:visible').length);
$(this).css('z-index', zIndex); $(this).css('z-index', zIndex);
setTimeout(function() { setTimeout(function () {
$('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack'); $('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack');
}, 0); }, 0);
}); });