I have a segment (of page view type), and it only has the bImage element. I am populating the segment and the end results are shown below. A user can manually swipe between various segment data. But, I am unable to replicate the same behaviour via the code.
Assume there are 3 images in the segment. So, I have to programmatically change from image 1 to image 3. How can I do that? (I do not want to repopulate the data). I just need to change the swap the segment's image 2 and move the page view to the other image.
Can someone help?
Hi Vishal, you can use the selectedRowIndex property of the segment. The section and row indices are zero-based.
this.view.mySegment.selectedRowIndex = [sectionIndex, rowIndex];
In the case of a single set of data, your section index would be zero, i.e.:
this.view.mySegment.selectedRowIndex = [0, 2];
Documentation reference is here under the Segment properties:
https://opensource.hcltechsw.com/volt-mx-docs/95/docs/documentation/Iris/iris_widget_prog_guide/Content/Segment_Properties.html
@Gunndarr Dotter it's not working for me. I am attaching the screenshots for your reference.
I am using this code in the form init function:
this.view.birthdayTemplates.onSelection = (e) => {
alert(this.view.birthdaySegment);
};
Output:
birthdayTemplates is a list box component. I am just printing out the birthday segment details when selecting a new list component. There is no variable in the output through which I can see the current image/data being displayed in the segment.
What's going wrong?
Any help @Gunndarr Dotter @Murali Boddeda, I am stuck with this
One more query:
Alongside my form controllers, there are some empty controllers and their action counterparts too (like FBox0d45c....) When I check their location on the form, they correspond to the different segments that I have used in the forms.
So, it is a default behaviour of Volt MX to make a controller and action file for segments?
Any update on this @Gunndarr Dotter ?
@Gunndarr Dotter, for me, the selectedIndex attribute worked.
pricingSegment.selectedIndex = [0, wishyUser.planIndex];
@Analyn Policarpio can you please mark the above thread as the correct solution for this query (I cannot mark my own reply as the answer)?