How to check a checkbox using Javascript?

I’m using the (old) datagrid element and with the select rows feature. Since I don’t want to select a row by checking the checkbox (a row shall be selected by a button click that is in that row), I gave the checkbox a specific id (e.g. “checkbox_123” for rowId 123) and tried to check the checkbox by adding custom Javascript that is triggered by clicking the button:

wwLib.getFrontDocument().getElementById(‘checkbox_123’).checked = true

However, I see in the console, that the checkbox got the checked-property “checked”, but it is not appearing as checked (the selected row is also not highlighted - which is what I’m actually trying to achieve).
How can this be fixed?

I think elements such as checkboxes that are nested inside a datagrid cannot be modified externally with JS.

I assume you need to fork the datagrid element and make those elements (with variables bound maybe) exposed.

1 Like