refactoring
This commit is contained in:
@@ -14,25 +14,8 @@ class BatchCodeTableInitializer {
|
|||||||
initialize() {
|
initialize() {
|
||||||
this.#batchCodeTable = this.#createEmptyBatchCodeTable();
|
this.#batchCodeTable = this.#createEmptyBatchCodeTable();
|
||||||
this.#countrySelect.addEventListener('change', event => this.#displayCountry(event.target.value));
|
this.#countrySelect.addEventListener('change', event => this.#displayCountry(event.target.value));
|
||||||
this.#displayCountry('Global')
|
this.#displayCountry('Global');
|
||||||
const histogramView = new HistogramView();
|
this.#initializeHistogramView();
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#createEmptyBatchCodeTable() {
|
#createEmptyBatchCodeTable() {
|
||||||
@@ -135,4 +118,25 @@ class BatchCodeTableInitializer {
|
|||||||
input.focus();
|
input.focus();
|
||||||
input.select();
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user