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



Feb 23, 2012, 9:55 AM
8 Posts

Re: Problem submitting an area of page

  • Category: Server Side JavaScript
  • Platform: Not Applicable
  • Release: 8.5.2
  • Role: Developer
  • Tags: partial refresh
  • Replies: 4
Hi Sven,
 
Thanks for your reply. I moved the code from beforePageLoad under a computed field within the panel that I'm trying to refresh. So the code now looks like this:
 
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
    <xp:panel id="panel1">
      <xp:text escape="true" id="computedField1">
        <xp:this.value><![CDATA[#{javascript:
             txt = "myJSONCategories = [{'category' : 'a'},{'category' : 'b'},{'category' : 'c'}]";
             var myJSONcategories = eval(txt);
             return myJSONcategories;}]]>
         </xp:this.value>
       </xp:text>
       <xp:br></xp:br>
       <xp:repeat id="repeat1" rows="30" var="category" value="#{javascript: return myJSONcategories;}">
            <xp:link escape="true" text="#{category.category}" id="link1">
                <xp:eventHandler
                    event="onclick"
                    submit="true"
                    refreshMode="partial"
                    refreshId="panel1">
                    <xp:this.action><![CDATA[#{javascript:viewScope.selectedPeriod = "";}]]></xp:this.action>
                </xp:eventHandler>
            </xp:link><xp:br></xp:br>
        </xp:repeat>
    </xp:panel>
</xp:view>
 
It didn't work this way either. Then I moved the computed field outside the panel but nothing changed. Still no luck...
Thanks,
 
Etyien
Feb 23, 2012, 11:28 AM
272 Posts
Re: Problem submitting an area of page
Hi again,
 
the problem is that recalculation of the values are not running correctly: The values of the repeat control are calculated two times during the refresh ( in JSF Phase 1 and 6 ), and the values from the computed field are only recalculated once in JSF phase 6. The SSJS variable is not available during Phase 1, that's why it fails.
 
You can use dataContext-Variables to fix this:
 
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
    <xp:panel id="panel1">

        <xp:this.dataContexts>
            <xp:dataContext var="data">
                <xp:this.value><![CDATA[#{javascript:txt = "myJSONCategories = [{'category' : 'a'},{'category' : 'b'},{'category' : 'c'}]";
             var myJSONcategories = eval(txt);
             return myJSONcategories;}]]></xp:this.value>
            </xp:dataContext>
        </xp:this.dataContexts>

        <xp:br></xp:br>
        <xp:repeat id="repeat1" rows="30" var="category"
            value="#{javascript: return data;}">
            <xp:link escape="true" text="#{category.category}"
                id="link1">
                <xp:eventHandler event="onclick" submit="true"
                    refreshMode="partial" refreshId="panel1">
                    <xp:this.action><![CDATA[#{javascript:viewScope.selectedPeriod = "";}]]></xp:this.action>
                </xp:eventHandler>
            </xp:link>
            <xp:br></xp:br>
        </xp:repeat>
    </xp:panel>
</xp:view>
 
Sven
 

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