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?