This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jan 4, 2012, 9:43 AM
19 Posts

Repeat control showing table

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags: Repeat Control
  • Replies: 5
I have successfully implemented a Java agent which returns a one-deminsional java.Vector with strings to my Xpages. I have used a Repeat Control to show the data and it is working fine. So the first column of my table is printed fine on the XPage.
 
My problem is that I want to display a table with several columns. Can a single Repeat Control handle that?  I can either send a two-deminsional vector to the repeat control or... I don't know how to this? In Other words:
 
Repeat Control
--------------col1--------------------col2------------------col3
row1: computedField1, computedField2, computedField3
row2:
row3:
 
How do I do this in single Repeat Control? 
Many thanx!!!
Jan 4, 2012, 9:47 AM
272 Posts
Re: Repeat control showing table
Hi,
 
you can do this with a second repeat control inside your first one.
 
Sven
 
Jan 4, 2012, 9:55 AM
19 Posts
Re: Repeat control showing table
Thank you Sven for your reply. So you mean if I have a table with 10 columns then I should I have 10 repeat controls inside each other?
 
Jan 4, 2012, 10:07 AM
19 Posts
Re: Repeat control showing table
I think I got what you mean... it needs two repeat controls. One for all rows and one for columns... I thought I could get the two-dimensional vector and bind data to computedField somehow but I couldn't make it work.
Jan 4, 2012, 10:56 AM
272 Posts
Re: Repeat control showing table
I don't know exactly what you are meaning with a "two dimensional vector" (as far as I understand a vecor is always one dimensional, but can contain another vector..), but here is an example:
 
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.dataContexts>
        <xp:dataContext var="data">
            <xp:this.value><![CDATA[#{javascript:var i=0;
                var j=0;
                var data:java.util.Vector = new java.util.Vector();

                for( i=0; i<5; i++){
                    var hlp:java.util.Vector = new java.util.Vector();
   
                    for(j=0;j<5+i;j++){
                        hlp.add( j );
                    }
   
                data.add( hlp );
            }}]]></xp:this.value>
        </xp:dataContext>
    </xp:this.dataContexts>
   
    <xp:repeat id="repeat1" rows="30" var="rowsVar" value="#{javascript:data}">
        <xp:repeat id="repeat2" rows="30" var="colsVar"  value="#{javascript:rowsVar}">
        <xp:text escape="true" id="computedField1" value="#{javascript:colsVar}"></xp:text>&#160;
        </xp:repeat>
    </xp:repeat>
</xp:view>
 
Hope this helps
Sven
 
Jan 5, 2012, 11:07 AM
261 Posts
Re: Repeat control showing table
You might also consider a solution where your agent returns a Vector where each element in the Vector is (for instance) an Array object containing an entry for each column.
 
That way you don't need to nest the repeat controls.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal