From 013546a45b7b1fa44f46a6de889cefbb1f4caa47 Mon Sep 17 00:00:00 2001 From: Davide Passoni Date: Fri, 8 Mar 2024 16:22:30 +0100 Subject: [PATCH] Fixed checkbox not working in export screen --- frontend/website/src/other/utils.ts | 10 ++++++---- frontend/website/src/unit/importexport/unitdatafile.ts | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/frontend/website/src/other/utils.ts b/frontend/website/src/other/utils.ts index f8e6d5ff..c5a4ccea 100644 --- a/frontend/website/src/other/utils.ts +++ b/frontend/website/src/other/utils.ts @@ -468,6 +468,7 @@ export function createCheckboxOption(text: string, description: string, checked: "disabled": false, "name": "", "readOnly": false, + "value": null, ...options }; var div = document.createElement("div"); @@ -476,10 +477,11 @@ export function createCheckboxOption(text: string, description: string, checked: label.title = description; var input = document.createElement("input"); input.type = "checkbox"; - input.checked = checked; - input.name = options.name; - input.disabled = options.disabled; - input.readOnly = options.readOnly; + input.checked = checked; + input.name = options.name; + input.disabled = options.disabled; + input.readOnly = options.readOnly; + input.value = options.value; var span = document.createElement("span"); span.innerText = text; label.appendChild(input); diff --git a/frontend/website/src/unit/importexport/unitdatafile.ts b/frontend/website/src/unit/importexport/unitdatafile.ts index 2a0c1611..0cffc11e 100644 --- a/frontend/website/src/unit/importexport/unitdatafile.ts +++ b/frontend/website/src/unit/importexport/unitdatafile.ts @@ -31,10 +31,11 @@ export abstract class UnitDataFile { headersHTML += `${coalition[0].toUpperCase() + coalition.substring(1)}`; const optionIsValid = this.data[category].hasOwnProperty(coalition); - let checkboxHTML = createCheckboxOption(`${category}:${coalition}`, category, optionIsValid, () => { }, { + let checkboxHTML = createCheckboxOption(``, category, optionIsValid, () => { }, { "disabled": !optionIsValid, "name": "category-coalition-selection", - "readOnly": !optionIsValid + "readOnly": !optionIsValid, + "value" : `${category}:${coalition}` }).outerHTML; if (optionIsValid)