How to set subitems in DialogListItem for List View?

I have a button script (JScript) with Dialog templates in Resources. One dialog has a List View with 2 columns.
I can populate the ListView just fine with dlg.Control("listview1").AddItem("whatever");, but I can't figure out how to add text for the second column.
The documentation is very scarce here. I assume I am supposed to work with the subitems as mentioned here - but where do I go from there?

I am quite put off by DOpus's use of weird objects that do not conform to standard JS objects, and "collections" that could just as well be Arrays with all their useful functionalities but aren't and thus require weird and clumsy iterators...
I tried something like

for(i=0; i<map.length; i++){
	var el = map[i];
	dlg.Control("listview1").AddItem(el.from);
	var sits = dlg.Control("listview1").GetItemAt(i).subitems;
	// sits[0] = el.to; // <- of course that would be too easy
	for (var menum = new Enumerator(sits); !menum.atEnd(); menum.moveNext()){
		menum.item() = el.to; // <- Erorr: Cannot assign to a function result (0x800a138b)
	}
}

But of course I can't assign a value to the iteration item.

Your help is much appreciated!

A couple of existing threads on the forum explain/show how to do it:

Uh... I'm not sure where in the back-end it failed, but the issue for me was that I tried

var sits = dlg.Control("listview1").GetItemAt(i).subitems;
sits(0) = "something";

, which didn't work

Object doesn't support this property or method (0x800a01b6)

, but
dlg.Control("listview1").GetItemAt(i).subitems(0) = "something";
worked.

I thought I Was missing something, but it looks like this is down to the way the secret sauce is implemented behind the scenes and incompatibility with standard JS implementations?
On a related note, I can never debug all the weird objects by reading their properties, it all shows up as empty :confused:

Anyway, thanks for providing the links (I googled for articles regarding "subitems" but didn't find those)

Note that Opus provides an IDispatch-compatible scripting interface, it's not specifically a JScript interface.

However we might be able to improve this. The issue is that when you call the subitems method without any arguments, Opus returns a reference to the collection, which only supports enumeration. Currently you have to call the subitems method with an index to make any changes.

That's why the example code in the first link works, because it takes a reference to the list item (the return value of GetItemAt) and then calls the subitems method each time to insert the sub-items.

I See, thank you for explaining that!
It would be nice to see more fleshed-out integration with intermediate objects with their own properties and methods, but I realize it's only a very minor issue

As soon as an object has custom methods/properties they do get documented; currently as the subitems method just returns a collection for enumeration the docs assume you'll know how to deal with that (For... Each in VBScript, or using an Enumerator in JScript) and aren't explicit about it. But certainly the docs could be improved for subitems since it does also let you modify the elements which is not normal for a collection.