I was able to achieve this with the following bit of jQuery[1] and XForms
structure:
jQuery:
$('#results-table').on('click', 'tbody tr', function(event) {
$(this).addClass('highlight').siblings().removeClass('highlight');
});
XForms:
<xf:group ref="instance('search-results')">
<table id="results-table">
<tbody>
<xf:repeat nodeset="*" id="search-results-repeat">
<tr>
<td>
<xf:trigger appearance="minimal">
<xf:label>
<xf:output value="name(.)"></xf:output>
</xf:label>
<xf:output ref="."></xf:output>
</xf:trigger>
</td>
</tr>
</xf:repeat>
</tbody>
</table>
</xf:group>
[1] http://jsfiddle.net/iambriansreed/xu2AH/9/
On Tue, Mar 17, 2015 at 4:01 PM, Tim Thompson <[email protected]> wrote:
> Hello,
>
> I would like to be able to add some simple styling to the items within an
> <xf:repeat> element. Specifically, I would like to use jQuery to attach a
> click listener to each div that has an "xforms-repeat-item" class. When a
> user clicks on a div within the repeat, for example, a "highlight" class
> would be added in order to generate a background color for the div.
> However, I find that within the <xf:repeat> I am only able to modify the
> first item (which has an "xforms-repeat-item-selected" class).
>
> Is there a way to achieve this functionality in XSLTForms?
>
> Thank you,
> Tim
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support