indexVar property from xp:repeat control not available in styleClass property of xp:button control

In an application we are using Bootstrap (BS) and in BS you can highlight the state of a button by adding an active (style)class. In my situation the button(s) reside in a repeat control and basically a click on a button will update a part of the screen and change the collection of documents displayed.

So my initial idea was to set a scope variable with the ID of the button clicked and update also the repeat control containing the buttons and modify the styleclass property based upon this scope variable.

How to get the client ID of an xp:control I found in the answer of Tim Tripcony on a question on Stackoverflow.

However I noticed a difference in the ID when an xp:control resides in a repeat control; it contains an incremental number from the repeat control e.g.


If you use the same method (


for an attribute or something you would miss the incremental number e.g.


So I posted a question on Stackoverflow about my options and thanks you for all the quick replies.

Some answers directed me to use the indexVar property of the repeat control and add place that in my scope variable and use it in the computation for the styleclass property of the button.

But then an error appeared on screen…

[ReferenceError] ‘index’ not found

I tested the computation with other xp:controls like a xp:link control or xp:computed text but no errors there.

So I assume this ‘feature’ (as my collegue names it) is just not implemented yet in XPages for the xp:button control?

One thought on “indexVar property from xp:repeat control not available in styleClass property of xp:button control

  1. Denis Kopprasch 2016-September-27 / 3:39 pm

    Hey Patrick, I stumbled upon this “feature” as well. Instead of a button i now use a computed text with tagName=”a” that renders like a button according to . I hope this doesn’t break crossbrowser compatibility.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s