Populate listview checkboxes default value

I am building a Inspection checklist app for our shop floor users. Something they want to do is to submit incomplete inspections and another user down the assembly line picks up where they left off. I am using a legacy listview to show the checklist questions. I have the answers stored in the retool database as booleans.

My first attempt was to use a forEach on the listview and for every checkbox set the value to the corresponding value from the table. Issue here is the checkbox value doesn't get set.

gaIncListView.data.forEach((el) => {
      el.gaIncChkBox.value = GAIncSearch.data.q1[0]; //also tried el.gaIncChkBox = ...
    });

The 2nd issue with this is I'm not sure how I would go through all of the GAIncSearch data. for this example, it would need to go from q1 - q12 (GAIncSearch.data.q1-q12[0]).

The listview data looks like:
image

the data from the database looks like this:
image

any help is greatly appreciated.

I think you're using the readOnly value property of the checkbox rather than the setValue function to set the value

ie el.gaIncChkBox.setValue(GAIncSearch.data.q1[0]);

1 Like

Thanks for the reply! Unfortunately I get setValue is not a function

'el.gaIncChkBox.setValue is not a function'

gaIncListView.data.forEach((el,i) => {
      gaIncChkBox[i].setValue( GAIncSearch.data.q1[0] ); // note I have no idea how your data looks or if that's the correct value to access
    });
1 Like

Isn't this a limitation of the new listView? If so you can either use the legacy component or store the listView data in a variable that you update, then set the select box default values to the value in the variable object.

I'm using a legacy listview

1 Like

You... totally said that in the OP. My apologies. @dcartlidge is steering you in the right direction.