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



Jul 15, 2011, 12:04 PM
22 Posts

Get custom control ID

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: getParent()
  • Replies: 1
I try to calculate the parentID for a custom control to access the custom properties via propertyMap()
 
Assume the following szenario:
 
- You have 2 custom controls ( cc-a and cc-b )
- cc-b has some custom properties
- you want to access this custom properties from cc-a ( cc-a is a custom control inside cc-b )
 
 I know, how to access the property and return the property value. I have the following function
 
function getPropertyValue(senderID, senderProp){
     if(null != senderID) {
        // get reference to the foreign custom control
        var senderComponent = getComponent(senderID);
        // get propertyMap of the foreign custom control
        var senderProperties = senderComponent.getPropertyMap();
        if(null != senderProperties) {
            // get senderProp value from the PropertyMap
            var ret = senderProperties.getProperty(senderProp);
            if (null != ret){
                return ret;
            }else {
                // if there is no such property return null
                return null;
            }
        }
    }
}
 
I can set the senderID to a static value and the code works, but I want to calculate the senderID of cc-b at runtime.
 
 
 
 
Jul 15, 2011, 12:27 PM
22 Posts
Re: Get custom control ID
After some try and error, I now have the following JS that seems to work
 
var dummy = getComponent(getComponent(this.getId()).getParent().getId()).getParent().getId();
return getPropertyValue(dummy, 'prop_BoxName');
 
Maybe there is a better / easier solutiion for this. Any hint is appreciated.
 

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