Skip to main content
Skip table of contents

The Default Template

The default template of PocketQuery produces a simple Confluence table:

The table has two columns Name and Population, according to the SELECT clause of the query. You can change this appearance with a custom template.

Templates for PocketQuery are written in Velocity, a Java templating language. Let’s have a look at the code of the default PocketQuery template that is selected by default for all queries.

HTML
<table class="aui confluenceTable pocketquery-table">
	<thead>
		<tr>
		#foreach ($column in $columns)
			<th class="confluenceTh">$!column</th>
		#end
		</tr>
	</thead>
	
	<tbody>
		#foreach ($row in $result)
			<tr>
			#foreach ($column in $row)
				<td class="confluenceTd">$!column</td>
			#end
			</tr>
		#end
	</tbody>
</table>

There is one loop for the header that runs through the column names and one loop (with another nested loop) running through the result. Note that the variables $columns and $result are passed to any PocketQuery template, so you can use them as you please. For a more formal specification of what kind of objects are available in PocketQuery templates, see Velocity API Available In Templates.

Continue with “Custom CSS To Highlight Particularly High/Low Values

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.