I am trying something new. I want to pass an arraylist with json objects via the property definition in a custom control. the property I called cols and is of type object.
On an xpage i have calculated the value of the property now as followed:
<xc:this.cols><![CDATA[#{javascript:var cols = [];
cols.push({
"colName" : "Petter",
"colValue" : "Developer"
});
cols.push({
"colName" : "Jesper",
"colValue" : "Administrator"
});
return cols;}]]></xc:this.cols>
Now in my repeater I want to use these objects/values. But I am not sure how?
First I tried outside my repeat control just how to access them in JavaScript e.g.:
<xp:text escape="true" id="computedField1">
<xp:this.value><![CDATA[#{javascript:var cols = compositeData.cols;
cols[0]["colValue"]}]]></xp:this.value>
</xp:text>
<xp:text escape="true" id="computedField3">
<xp:this.value><![CDATA[#{javascript:var cols = compositeData.cols;
cols[1]["colValue"]}]]></xp:this.value>
</xp:text>
This seems to work because I get the values Developer and Administrator returned.
Now I want to access the json in my repeat control but I get lost here.
Here is how I have set up my repeat control:
<xp:repeat id="repeat1" rows="30" var="colObj" indexVar="idx"
value="#{javascript:compositeData.cols}">
Then I have placed a computed text control within my repeat control and try something similar:
<xp:text escape="true" id="computedField2">
<xp:this.value><![CDATA[#{javascript:colObj[idx]["colValue"]}]]></xp:this.value>
</xp:text>
But then I get an error:
com.ibm.xsp.binding.javascript.JavaScriptValueBinding.getValue(JavaScriptValueBinding.java:132)
Can someone explain what I have done wrong and how I should do it correctly?