In the component, there is a segment that consists some labels and button. On the click of the button I want to execute the component's exposed method. But inside the segment this method is unavailable.
Hello @Bibin Philip ,
I tried a sample app in which I created a component with contract having a segment widget in it. This component exposes a custom method "componentCustomMethod", this custom method just shows an simple alert. The segment which is present in the component is using a template for defining the design for each row of the segment. "SampleSectionHeaderTemplate" is the template with a label and a button in it which is used by the segment in the component. In the button's onClick event in the template "SampleSectionHeaderTemplate", I used and add snippet with below code snippet to call the custom method "componentCustomMethod", which is exposed by the component.
this.executeOnParent("componentCustomMethod",{"dataFromButtonInSegTemplate":"Bankapalli"});
Component UI:
Segment in the component using "SampleSectionHeaderTemplate" template:
Component exposing a custom method "componentCustomMethod":
Definition of the custom method in the component's controller:
Add Snippet action used in the onClick event of button in the template "SampleSectionHeaderTemplate", which is used as row template in the segment "segProducts" in the component "com.test.test":
Output, showing an alert from the component's custom method when clicked on the button in any of the segment within the component:
Please review these inputs might help in your scenario. Thank you.
Thanks and Regards,
Venkata Raju Bankapalli





