Set a checkbox inside a repeater to True BEFORE displaying the repeater

When my page opens, a repeater containing a checkbox and other elements is populated from a database. When I click a specific text box on the page, the onClick event handler displays the repeater. However, BEFORE displaying the repeater, I make a few changes to the data in the repeater.

First I change one of the repeater’s values (.price) using the following code: The below works fine.

$w ( ‘#txtD’ ). onClick ( async ( event ) => {
// This gets the current repeater data
let dataArray = $w ( “#rptDS” ). data ;
// This changes a velue in the data
dataArray [ 0 ]. price = 0 ;
// This clears all data from repeater
$w ( “#rptDS” ). data = [];
// This populates the repeater (onItemReady event handler is triggered)
$w( “#rptDS” ). data = dataArray ;
})
Second I need to set the checkbox to true AND disable it BEFORE the repeater is displayed, so there is no ability to trigger an event. I have been struggling for days with this problem. Since $w(“rptDS”).data, the repeater’s data, does not expose the status of the checkbox, I don’t know how to access it. The question is how can I access the checkbox in the repeater (without triggering an onClick event)? I have even reviewed Yisrael’s ToDoMVC example, but even there an event is triggered.

Does anyone have any ideas how I might do this?

I hope this is enough information. My example is a bit dumbed down for the sake of my question, but does shows the salient parts I hope. Thanks for your help.

Normaly if you want to set the state of a check-box inside your repeater, your REPEATER-DATA, should also carry this information inside.
Is it not possible for you to INCLUDE this information inside your REPEATER-DATA?

Normaly after you have feeded your REPEATER with new REPERATER-DATA, it triggers automaticaly an EVENT … take a look onto the next coding-part…

$w('#myREPERATER').onItemReady(($item, itemData, index)=>{
    $w('#myWantedCheckbox').checked = itemData.checkboxState 
});

Your DB-Field → checkboxState - → includes the needed information (true/false);

Thank you, thank you! Your question got me thinking about this another way. To answer your question directly, No, it is not possible to include precheck information inside my repeater data. The prechecked items are highly dependent on multiple other selections made elsewhere on the page.

But, while it is not possible at the start of the page setup, it IS possible later on after the dependencies are known.

I recently learned the onItemReady event handler, where the repeater is first populated, automatically reruns itself every time the source data is changed. Wonderful! Since my preselected items are already being processed as part of that onItemReady function, all I need to do is change my preselection object array when dependencies change the pre-selection items and repopulate the repeater any time I need to.

Seems simple enough. What do you think?

To answer your second question, it does not include that field (checkboxState). Prior to your comment, I was thinking about that as a method to get this working, but rejected it because the “output” database of checked items is populated from the repeater selections, not from another source. And the input to the repeater would not include that information yet either.

@jimyaccino
Your problem is …

And the input to the repeater would not include that information yet either.
Show your DATABASE, which is related to your issue, please.