diff --git a/docs/batchCodeTable.js b/docs/batchCodeTable.js index 32703ee92d5..6f460e2c4c7 100644 --- a/docs/batchCodeTable.js +++ b/docs/batchCodeTable.js @@ -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); + } + }); + } }