adding control column

This commit is contained in:
frankknoll
2023-01-25 11:13:50 +01:00
parent b9c7b2789d
commit 7ef46c8ee3
26 changed files with 99 additions and 305 deletions

View File

@@ -120,8 +120,24 @@ class BatchCodeTableInitializer {
#displayCountry(country) {
this.#heading.textContent = country == 'Global' ? 'Global Batch Codes' : `Batch Codes for ${country}`;
this.#batchCodeTable.ajax.url(`data/batchCodeTables/${country}.json`).load();
this.#selectInput();
fetch(`data/batchCodeTables/${country}.json`)
.then(response => response.json())
.then(json => {
this.#_addEmptyControlColumn(json);
return json;
})
.then(json => {
this.#batchCodeTable
.clear()
.rows.add(json.data)
.draw();
this.#selectInput();
});
}
#_addEmptyControlColumn(json) {
json.columns.unshift('control');
json.data.forEach(row => row.unshift(null));
}
#selectInput() {