Listview Children Array Functions

I cannot figure out how to treat listview children like arrays.

For example, I have a checkbox in a list view and would like to know if any of the checkboxes have been checked. So, I would like to do something like this:

{{ Array.from(checkbox1).some((item) => item.value) }}

Instead, I need to do something convoluted like this:

{{ Array.from({length: listView1.instances}, (v, i) => checkbox1[i].value).some((item) => item) }}

Hey @Kade333!

This isn't the cleanest code but it should work:

{{Object.assign([], checkbox1).some(item => item.value)}}

That takes advantage of the fact that arrays are special instances of objects and assigns all the properties of the checkbox1 object, some of which happen to have numerical keys so they end up working as entries in the array which isn't the greatest pattern.

Curious to know if anyone else has other ideas as well :slightly_smiling_face:

1 Like