0
votes

i'm using a repeat control in my XPage which contains some repeated sections. The titles/header of this sections are computed from a JSON String which is stored in a sessionScope variable. So far evrything works fine.

Now i have to expand/collapse one or more sections with a button outside the repeat control.

The button "knows" the title and the header of the section which have to be collapsed/expanded. How can i get the right ID to use something like:

getComponent("XXXXXXX").setClosed(true);

Any Ideas?

1

1 Answers

2
votes

You can achieve this in client side JavaScript. First you need to find the ID of section which contains your header text. For that you can use a simple dojo.query with selectors.

var sectionID = dojo.query(".xspSection:contains('<YOUR HEADER TEXT>')")[0].id;

This would search for all the sections on your page with your specified header text in it and return all the nodes. Assuming that your header is unique get the first node (that's why the [0]) and from it get the ID of section. Once you have the ID use the XSP object to show/hide section.

XSP.showSection(sectionID, [true|false]);