I think I want something impossible, but I'll give it a try.
I have the following code:
<xp:repeat id="repeat1" rows="30" var="rowData" repeatControls="false" indexVar="index">
<xp:this.value>
<![CDATA[#{javascript:var value1 = docDocument.getItemValue("DocInternNume");
var toStr1 = value1.toString().replace("[","").replace("]","").split(",");
var value2 = docDocument.getItemValue("DocIntern");
var toStr2 = value2.toString().replace("[","").replace("]","").split(",");
var ar = new Array(2);
for(var x =0; x<ar.length;x++)
{
ar[x] = new Array(toStr1.length)
for(var y=0;y<toStr1.length;y++){
if(x==0){
ar[x][y] = toStr1[y];
}
if(x==1){
ar[x][y] = toStr2[y];
}
}
}
return ar;}]]></xp:this.value>
<xp:link escape="true" id="link2" text="#{javascript:rowData;}"
value="#{javascript:rowData;}">
</xp:link>
<xp:br></xp:br>
</xp:repeat>
Code explanation:
A repeat control which takes as value 2 fields which have:
After that, I am saving those field values in a multidimensional array, length of 2 which I return as the repeat value.
Why do I return a multidimensional array in the repeat:
In the repeat as you can see in the above code I have a link which label
I want to take the value of the 1st field (the Names) and the URL
I want to take the value of the 2nd field (the docID).
Why? because I want to give the user the capability to select some documents in a parent document and after, in a repeat to show the links to the child documents.
Question: is there a way to return a multidimensional array within a repeat and then give to the label
for eg: rowData[0] and to the URL
the rowData[1] value? Or is there another way I can achieve this?
As far as I could do the repeat only returns an array.