VladP VladP - 1 year ago 147
Javascript Question

xPages nested repeat control doesn't show anything

Here is my xPage with two repeat controls (the second one is nested)

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.beforePageLoad><![CDATA[#{javascript:viewScope.MY_SCOPE = new Array();
viewScope.MY_SCOPE.push(["A1", "B1", ["aaa1", "bbb1", "ccc1"]]);
viewScope.MY_SCOPE.push(["A2", "B2", ["aaa2", "bbb2", "ccc2"]]);
viewScope.MY_SCOPE.push(["A3", "B3", ["aaa3", "bbb3", "ccc3"]]);}]]></xp:this.beforePageLoad>
<xp:repeat id="repeat1" rows="30"
value="#{javascript:viewScope.MY_SCOPE}" var="rowData" indexVar="rowDataIndex"
<xp:text escape="false" id="computedField1">
<xp:repeat id="repeat2" rows="30" var="rowDataSub" indexVar="rowDataSubIndex"
<xp:text escape="false" id="computedField2">
<xp:text escape="false" id="computedField3">

As a data I'm using array scopeVariable. It works perfect for parent repeat and shows scopeVariable data in computed field computedField1. For nested repeat I use an array that is third element of scopeVariable. But nested repeat doesn't show anything in computed field computedField2. Is anything wrong with my repeats?

Answer Source

Change this line of code


The nested repeat control runs already over all entries in sub array.
So, access current entry with rowDataSub instead of rowDataSub[0].

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download