Question

Im trying to pass value/datasource from different buttons to child CC2 from CC1.

I have:

  • root
    • cc1
      • button named "test"
      • cc2 with custom property "stringDataSrc"
        • computed field named "showValue"

Computed field "showValue" shows value of stringDataSrc.
Button "test" SSJS code: getComponent(cc2).getAttributes().size() returns 0.


How do I change custom property value of cc2 from button "test" with onclick event?

Was it helpful?

Solution

If I'm interpreting your goal correctly, the method you're looking for is getPropertyMap:

getComponent("cc2").getPropertyMap().put("stringDataSrc", newValue);

This should update the property value that is referenced within that Custom Control (via compositeData) to return the new value instead.

OTHER TIPS

Making some assumptions due to current lack of code above.

From within the cc2, you don't really have the ability to change the custom property because that is passed in from the containing cc1. So what you need to do is have the button change the value that is passed into cc2 and then refresh cc2.

So for example instead of <xc:cc2 customProperty="Hello"> you'll want to use <xc:cc2 customProperty="#{dataSource.value}">

Then your button can update dataSource.value and refresh cc2.

You can also most easily retrieve your property value through compositeData.customProperty

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top