I am trying to create a simple tool to annotate pairs based on observable js : Test outil annotation / Lino Galiana | Observable
I have two input buttons in this notebook:
- Radio button to choose if we have pairs or not
- A button to increment to next example
The radio button is created like that:
decision_label = [
{text: "Accepter 👍️", color: "green", decision: "Accepted"},
{text: "Rejeter 👎️", color: "red", decision: "Rejected"},
null
]
viewof decision = Inputs.radio(
decision_label,
{label: "Décision",
format: x => (x == null) ? html`<span style="border-bottom: solid 2px blue; margin-bottom: -2px;">Décision à prendre` : html`<span style="text-transform: capitalize; border-bottom: solid 2px ${x.color}; margin-bottom: -2px;">${x.text}`,
value: null
}
)
The other button is created like that:
viewof count = {
let value = 0;
const button = html`<button>Nouvel exemple Ă annoter !</button>`;
Object.defineProperty(button, "value", { get() { return value; } });
button.onclick = () => {
++value;
};
return button;
};
I would like the radio button to come back to null value when I click on the other one. I guess this has something to deal with button.onclick
but I do not manage to override decision
value.
Do you have any idea ?