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



May 7, 2012, 10:45 PM
2 Posts

Computed Include page inside a Repeat panel

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 4
Hi
I have some problem and I can't resolve it.
I made a repeat panel with a JS data binding
 
var v = database.getAllDocuments();
......
return v; 
 
And I named Collection Name as 'rowData'
Inside the repeat panel I put  Include Page control.
 
My target is to compute a page name to load in include page control based on data from 'rowData', but there is an error when I type code
rowData.getItemValueString("Form");
"Error while executing JavaScript computed expression
Script interpreter error, line=1, col=9: [ReferenceError] 'rowData' not found"
 
So how can I do it?
 
May 8, 2012, 7:21 AM
126 Posts
Re: Computed Include page inside a Repeat panel
can you post a small section of your code. 
 
If you have a repeat control with      value="#{javascript: ... }"     and    var="rowData"
 
Theres 2 reasons you could be getting that error, rowData is null (meaning no data inside it) and you getting that error because your trying to access data inside it that doesn't exist. Try printing to the console to see are you infact getting the data for the repeat.
Or where your referencing "rowData" is not inside the repeat control.  
May 8, 2012, 1:48 PM
17 Posts
Re: Computed Include page inside a Repeat panel
 Which version of the below code you're using?
  "${javascript:rowData.getItemValueString('form')" or "#{javascript:rowData.getItemValueString('form')} 
 
I think you're using the first version i.e  on page load. 
rowData is not found while loading. That's causing the issue. 
 
To solve it, use the rendered property instead of loaded. 
 
 
May 8, 2012, 9:45 PM
2 Posts
Re: Computed Include page inside a Repeat panel
Yes, there is '$'
 
There is no chance to change to '#' because of there is no such option in 'compute page name', no radio button available
 
When I change it in source code to '#' I got an error
 
The value of the property pageName cannot be a run time binding. 



Repeat panel code
 
<xp:repeat id="repeat1" rows="30" var="rowData"
                repeatControls="false">
                <xp:this.value><![CDATA[#{javascript:var v = database.getAllDocuments();
v.FTSearch("FIELD doclD CONTAINS " + sessionScope.get("docID"),0);
return v;

}]]></xp:this.value>
                <xp:panel>
                    <xp:section id="section1" initClosed="true">
                        <xp:this.header><![CDATA[#{javascript:rowData.getItemValueString("name")}]]></xp:this.header>   /// <- It works good
                        <xp:include id="include1" loaded="true">
                            <xp:this.pageName><![CDATA[${javascript:rowData.getValueItemString("Form")}]]></xp:this.pageName>
                        </xp:include>
                    </xp:section>
                </xp:panel>
            </xp:repeat>

 
 
 
 
May 9, 2012, 8:13 AM
2 Posts
Re: Computed Include page inside a Repeat panel
Hi,
 
The ${...} syntax does not allow you to access a runtime variable like your "rowData" object. So, the <xp:include> tag is of no help for you.
Using a rendered attribute is also not a good idea, because it will make you generate a very big component tree. 

Instead, you must use the <xe:switchFacet> control from the extension library. It is also available in the Domino 8.5.3 Upgrade Pack 1.
 
To use it, simply create a custom control per form (supposing your forms are named "Form1" and "Form2"), and then,inside your repeat control, use this code:
<xe:switchFacet selectedFacet="#{javascript: rowData.getItemValueString('Form')}">
     <xe:this.facets>
         <xp:ccForm1 xp:key="Form1"/>
         <xp:ccForm2 xp:key="Form2"/>
     </xe:this.facets>
</xe:switchFacet>
 
Google for "XPages switchFacet control", and you will find a lot of interesting information.
 
Regards,
 
Lionel

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