fix »checkall« intiialization after content change

This commit is contained in:
Felix Hamann 2019-03-03 12:05:05 +01:00
parent 544392404f
commit aaf496f753
3 changed files with 7 additions and 2 deletions

View File

@ -6,6 +6,7 @@
var HEADER_HEIGHT = 80;
var RESET_OPTIONS = [ 'scrollTo' ];
var TABLE_FILTER_FORM_CLASS = 'table-filter-form';
var ASYNC_TABLE_CONTENT_CHANGED_CLASS = 'async-table--changed';
var ASYNC_TABLE_LOADING_CLASS = 'async-table--loading';
var JS_INITIALIZED_CLASS = 'js-async-table-initialized';
@ -45,6 +46,9 @@
// pagesize form
pagesizeForm = wrapper.querySelector('#' + tableIdent + '-pagesize-form');
// check all
window.utils.setup('checkAll', wrapper);
// filter
var filterForm = wrapper.querySelector('.' + TABLE_FILTER_FORM_CLASS);
if (filterForm) {
@ -171,6 +175,7 @@
tableOptions = tableOptions || {};
wrapper.innerHTML = newHtml;
wrapper.classList.remove(JS_INITIALIZED_CLASS);
wrapper.classList.add(ASYNC_TABLE_CONTENT_CHANGED_CLASS);
// setup the wrapper and its components to behave async again
window.utils.teardown('asyncTable');

View File

@ -3,6 +3,7 @@
window.utils = window.utils || {};
var ASYNC_TABLE_CONTENT_CHANGED_CLASS = 'async-table--changed';
var JS_INITIALIZED_CLASS = 'js-check-all-initialized';
var CHECKBOX_SELECTOR = '[type="checkbox"]';
@ -12,7 +13,7 @@
window.utils.checkAll = function(wrapper, options) {
if (!wrapper || wrapper.classList.contains(JS_INITIALIZED_CLASS)) {
if ((!wrapper || wrapper.classList.contains(JS_INITIALIZED_CLASS)) && !wrapper.classList.contains(ASYNC_TABLE_CONTENT_CHANGED_CLASS)) {
return false;
}
options = options || {};

View File

@ -6,6 +6,5 @@ document.addEventListener('DOMContentLoaded', function() {
if (wrapper) {
window.utils.setup('asyncTable', wrapper, { headerDBTableShortcircuit, dbtIdent });
window.utils.setup('checkAll', wrapper);
}
});