diff --git a/development/issues/closed/200.html b/development/issues/closed/200.html new file mode 100644 index 0000000000000000000000000000000000000000..2936925259591881897e329ba59e86cbd4ace96a --- /dev/null +++ b/development/issues/closed/200.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<html lang="en" data-monster-theme-name="dark-mode"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Reloading options in a select does not work #200</title> + <script src="./200.mjs" type="module"></script> +</head> +<body> +<h1>Reloading options in a select does not work #200</h1> +<p>If a URL is changed and reloaded in a select, the result of the selection is incorrect.</p> +<ul> + <li><a href="https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/200">Issue #200</a></li> + <li><a href="/">Back to overview</a></li> +</ul> +<main> + + <button id="load-next">load next url</button> + <hr> + <monster-select + data-monster-option-url="/issue-200-1.json" + data-monster-option-mapping-labeltemplate="name" + data-monster-option-mapping-valuetemplate="id" + ></monster-select> + +</main> +</body> +</html> diff --git a/development/issues/closed/200.mjs b/development/issues/closed/200.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b20f655e65e913ba498c532faee896051e411a4b --- /dev/null +++ b/development/issues/closed/200.mjs @@ -0,0 +1,25 @@ +/** + * @file development/issues/open/200.mjs + * @url https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/200 + * @description Reloading options in a select does not work + * @issue 200 + */ + +import "../../../source/components/style/property.pcss"; +import "../../../source/components/style/normalize.pcss"; +import "../../../source/components/style/typography.pcss"; +import "../../../source/components/style/link.pcss"; +import "../../../source/components/style/color.pcss"; +import "../../../source/components/form/select.mjs"; + + +document.querySelector("#load-next").addEventListener("click", (e) => { + + const json1 = "/issue-200-1.json" + const json2 = "/issue-200-2.json" + + const select = document.querySelector("monster-select"); + console.log(select.getOption("url") === json1) + select.setOption("url", select.getOption("url") === json1 ? json2 : json1); + select.fetch(); +}) \ No newline at end of file