refactoring

This commit is contained in:
frankknoll
2023-01-28 16:45:40 +01:00
parent 4c79d50a4a
commit 7c1a82b1ac

View File

@@ -14,25 +14,8 @@ class BatchCodeTableInitializer {
initialize() {
this.#batchCodeTable = this.#createEmptyBatchCodeTable();
this.#countrySelect.addEventListener('change', event => this.#displayCountry(event.target.value));
this.#displayCountry('Global')
const histogramView = new HistogramView();
const thisClassInstance = this;
$(`#${this.#batchCodeTableElement[0].id} tbody`).on(
'click',
'td.dt-control',
function () {
const tr = $(this).closest('tr');
const row = thisClassInstance.#batchCodeTable.row(tr);
if (row.child.isShown()) {
row.child.hide();
tr.removeClass('shown');
} else {
const uiContainer = document.createElement("div");
row.child(uiContainer).show();
tr.addClass('shown');
histogramView.show('FD6840', uiContainer);
}
});
this.#displayCountry('Global');
this.#initializeHistogramView();
}
#createEmptyBatchCodeTable() {
@@ -135,4 +118,25 @@ class BatchCodeTableInitializer {
input.focus();
input.select();
}
#initializeHistogramView() {
const histogramView = new HistogramView();
const thisClassInstance = this;
$(`#${this.#batchCodeTableElement[0].id} tbody`).on(
'click',
'td.dt-control',
function () {
const tr = $(this).closest('tr');
const row = thisClassInstance.#batchCodeTable.row(tr);
if (row.child.isShown()) {
row.child.hide();
tr.removeClass('shown');
} else {
const uiContainer = document.createElement("div");
row.child(uiContainer).show();
tr.addClass('shown');
histogramView.show('FD6840', uiContainer);
}
});
}
}