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



Aug 29, 2011, 7:42 AM
21 Posts

Dynamic databinding

  • Category: APIs
  • Platform: All
  • Release: 8.5.2
  • Role:
  • Tags: expression language el databinding
  • Replies: 6
Dear all,
 
Is there a way to compute the El language used to bind a control to a bean? In the examples I found they use a static name *using the faces config files. But for my project I need it to be a computed value. In the requestscope add a custom java object to a computed key ( using the @Unique). The value of this computed key is transfered to the custom control using properties. 
 
 
Aug 29, 2011, 8:26 AM
272 Posts
Re: Dynamic databinding
Hi,
 
yes you can compute the databindig, but you have to do this in "OnPageLoad"-Event:
 
<xp:inputText id="inputText1">
   <xp:this.value><![CDATA[${javascript:
      var fName = "Test";
      return '#{document1.' + fName + '}';
   }]]></xp:this.value>
</xp:inputText>

 
The $ is the key.
 
Hope this helps
Sven
Aug 29, 2011, 8:52 AM
21 Posts
Re: Dynamic databinding
 
Hi Sven,
 
I dont think this is gonna work since I use a compositeData.requestVar variable to determine which object I need to grab from the requestScope. This is done because the custom control is 'dynamicly' loaded using a repeater. On each iteration the repeater defines which data object is should create ( java object). This object stores data about the current field (value, name, type etc). With this information the correct custom control is being loaded. When add stuff ot the onpageload event the data needed isn't there yet I think therefore it fails with an exception. Is there a way to bind a control to the request map that is being constructed when a post is done? 
Aug 29, 2011, 9:43 AM
21 Posts
Re: Dynamic databinding
Hi Sven,
 
I cannot find the onpageload event do you mean the beforepageload event??  When I try to retrieve the compositeData var in the beforepageload event I get an error it cannot find the var I'm asking for. I think this is due to the fact that the control is being loaded from a repeater?
Aug 29, 2011, 10:07 AM
272 Posts
Re: Dynamic databinding
Hi,
 
this is not a event, it is a definition how the value is rendered:
 
    <xp:label id="label1"><xp:this.value><![CDATA[${javascript:"Compute On PageLoad"}]]></xp:this.value></xp:label>
    <xp:label id="label2"><xp:this.value><![CDATA[#{javascript:"Compute Dynamically"}]]></xp:this.value></xp:label>
 
If there is a # before the value will be computed every time the label is refreshed.  If there is a $ the value is computed if page is loaded. The last one is always executed before the dynamically computation. That is why you can compute a binding "On Page Load" which then is binded dynamically (what I have wroted before: "the $ is the key").
 
Hope this helps
Sven
Aug 29, 2011, 10:20 AM
21 Posts
Re: Dynamic databinding
Hello Sven,
 
thanks I already new the difference between # and $ but got a bit confused since you wrote "OnPageLoad"-Event:" .
Aug 29, 2011, 5:57 PM
272 Posts
Re: Dynamic databinding
Oh, Sorry for that. Have you tried to use a data context for your objects?

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