Intermediate refactoring

This commit is contained in:
Pieter Vander Vennet 2020-07-20 18:24:00 +02:00
parent 069cddf034
commit 7b80e945bb
16 changed files with 43 additions and 44 deletions

View file

@ -62,7 +62,7 @@ export class RadioButton<T> extends InputElement<T> {
return 'radio-' + this.id + '-' + i;
}
protected InnerRender(): string {
InnerRender(): string {
let body = "";
let i = 0;
@ -83,14 +83,16 @@ export class RadioButton<T> extends InputElement<T> {
if (t === undefined) {
return;
}
console.log("Trying to find an option for", t)
// We check that what is selected matches the previous rendering
for (let i = 0; i < this._elements.length; i++) {
const e = this._elements[i];
if (e.IsValid(t)) {
this._selectedElementIndex.setData(i);
e.GetValue().setData(t);
const radio = document.getElementById(this.IdFor(i));
// @ts-ignore
document.getElementById(this.IdFor(i)).checked = true;
radio?.checked = true;
return;
}