Strange behavious on table repeat

wapper 3.4.1 docker, php, windows 10

Hi,

I seem to be getting a strange bug I cant explain. I basically have a repeater table that displays a bunch of rows and in each row is checkbox that if ticked does a SC update.

The SC side all works, if i tick the chekbox it DOES update the DB and if I tick it again it does the update, so it sets a cell to 0 or 1.

But, I cannot get the checkbox to reflect the cheked status, but I know the data returned is correct.

So my code is:

 <form id="loaded{{id}}">
	<input type="checkbox" value="1" id="loaded{{id}}" name="loaded" dmx-bind:checked="loaded" dmx-on:changed="sc_JobItem_upd.load({id: id, loaded: loaded == 0 ? 1 : 0})">
</form>
<p>loaded cell value: {{loaded}}

so you can see if have the checked value to use the table repeat {{loaded}} - and, to be sure I am getting the right value I display that outside the checkbox.

1

but the checkbox is not checked even though you can see it returns “1” I tried using toNumber() but then I get no value.

Stumped, sure I have done something stupid again. My ternary bit all works lovely doing the update and then I reload the SC to refresh teh table data, but i never get the checkbox checked

Thanks

So are you trying to check the checkbox if the database value is 1?

If yes, you need to use:

dmx-bind:checked="loaded == 1"

thanks, that got it, but oddly I have a toggle switch and on that didnt need to use the qualifer of == 1 , I just used the query name and that worked,but the == 1 seems to have fixed it :slight_smile:
thanks