Repeat with Header and Footer facets

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
	<xp:repeat id="repeatList"
		value="#{javascript:[['1','One'], ['2','Two'], ['3','Three']]}"
		var="rowData">
		<xp:this.facets>
			<xp:text disableTheme="true" xp:key="header" escape="false">
				<xp:this.value>
					<![CDATA[<table><th>Numeric</th><th>Textual</th>]]>
				</xp:this.value>
			</xp:text>
			<xp:text disableTheme="true" xp:key="footer" escape="false">
				<xp:this.value>
					<![CDATA[</table>]]>
				</xp:this.value>
			</xp:text>
		</xp:this.facets>
		<xp:tr>
			<xp:td>
				<xp:text value="#{rowData[0]}"></xp:text>
			</xp:td>
			<xp:td>
				<xp:text value="#{rowData[1]}"></xp:text>
			</xp:td>
		</xp:tr>
	</xp:repeat>
</xp:view>





Simple Repeat example demonstrating use of the Header and Footer facets to provide column header elements.

XPages
Tony McGuckin
July 31, 2012 7:27 AM
Rating
344

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



1 comment(s)Login first to comment...
Thomas Adrian
(at 05:26 on 09.08.2012)
This is a cool way of adding stuff within a repeat that should only be displayed once. say for instance you want to create a list of filter links from a view in an horisontal line and would like to include an "All" link to remove the filter. (e.g All | Cars | People | Houses). if you instead try and add the "All" link before the repeat you will get an unwanted carrige return.

Thanks for posting this.