- I have this custom control that has a multi-value property. That multi-value property is a group, so it contains subordinate custom properties. This works well for hard-coding:
<xc:control>
<xc:this.multiValueProp>
<xc:multiValueProp subProp1="first" subProp2="second" />
<xc:multiValueProp subProp1="eins" subProp2="zwie" />
</xc:this.multiValueProp>
</xc:control>
What I need to do is replace <xc:this.multiValueProp> with a computed expression that passes data to the custom control in a way that it understands.
- Inside the custom control, compositeData.multiValueProp is an array, and each element of that array has subProp1 & subProp2:
compositeData.multiValueProp[0].subProp2 is "second".
So far I've only gotten one element to pass in when computed:
<xc:control>
<xc:this.multiValueProp><![CDATA[#{javascript:
var oneEntry = { subProp1: "first", subProp2: "second" };
return oneEntry;
</xc:this.multiValueProp>
</xc:control>
The above works, but so far I have been unable to add more than one entry.
var twoEntries = { { subProp1: "first", subProp2: "second" }, { subProp1: "eins", subProp2: "zwie" } }
return twoEntries;
^^-- Fail with : expected after first {
var twoEntries = [];
twoEntries.push( { subProp1: "first", subProp2: "second" } );
twoEntries.push( { subProp1: "eins", subProp2: "zwie" });
return twoEntries;
^^-- Fail without error, but without data in xc:control, either
var twoEntries = new java.util.Vector();
twoEntries.add( { subProp1: "first", subProp2: "second" } );
twoEntries.add( { subProp1: "eins", subProp2: "zwie" });
return twoEntries;
^^-- Fail at add() because the JSON isn't recognized.
- Any thoughts on doing this? Thanks for your time...