Client Views Details

The Details View can display information related to a selected entity, like the Data View, but it can format the data in a more pleasing manner by specifying a template to be used to display the data, this way advanced HTML formatting can be used to pretty up the display of the information.

The details view will only display one record at a time, but provided a paging toolbar for navigating between records if there is more than one available.

Id
com.cohga.client.panel.details

The following is a basic example of the details panel

Details panel generating default templates
	<view id="com.cohga.client.panel.details">
		<location>west</location>
		<label>Details</label>
		<detail>
			<data>ar_road_details</data>
		</detail>
		<detail>
			<data>ar_property_details</data>
		</detail>
	</view>

The above example will add the details view and setup the display of details for roads and properties.

Any entity that you want to be displayed in this panel must have a details entry in the details panel configuration, and only one detail entry per entity is supported.

The details panel understands a data tag, which already includes the entity, label and datadefinition (a template is defined automatically, unless it's also provided), alternatively these values can be specified directly.

The previous example did not include a template, so the Weave client will generate a simple default template that will list each attribute from the underlying data, using the label to annotate each entry. If you want more control over the output then you can set a template that contains HTML marker with place holders that mark where the associated attribute should be placed.

Details panel with a template
	<view id="com.cohga.client.panel.details">
		<location>west</location>
		<label>Details</label>
		<loadingText>Loading...</loadingText>
		<detail>
			<data>ar_owner_details</data>
			<template><![CDATA[
The property located at<br/>
<b>{address}</b><br/>
is currently owned by<br/>
{owner}<br/>
of<br/>
{owner_address}
<hr>
<i>Links</i>
{owner_link}<br/>
{occupier_link}<br/>
{property_link}<br/>
			]]></template>
		</detail>
	</view>

If you use a template then there is no need to specify a label if you use the entity/datadefinition format (as opposed to the data format) to configure the details, since the label is just used in the default template that the Weave client will generate if no template is set.
If you still want a label at the top if the details then you'll need to put it there yourself if you use a template.

You can set the text to be displayed when data is being loaded, when there are no records to display and if an error occurs when retrieving the data by setting the loadingText, emptyText and errorText properties in the details panel. Also, the tooltip content can be altered by setting a tooltip element.

Details panel with modified text
	<view id="com.cohga.client.panel.details">
		<location>west</location>
		<label>Details</label>
		<emptyText>No results</emptyText>
		<loadingText>Please wait</loadingText>
		<errorText>Sorry, the server was unable to load data</errorText>
		<tooltip>
			<title>More Details</title>
			<text>Display details about the selected object</text>
		</tooltip>
		<detail>
			<data>ar_road_details</data>
		</detail>
		<detail>
			<data>ar_property_details</data>
		</detail>
	</view>

If you use complex templates then it may be worth using snippets to move the templates out of the configuration of the details panel itself (and possibly even store them in a separate configuration file)

Details panel with a template
<client:template id="owner_details">
<![CDATA[
The property located at<br/>
<b>{address}</b><br/>
is currently owned by<br/>
{owner}<br/>
of<br/>
{owner_address}
<hr>
<i>Links</i>
{owner_link}<br/>
{occupier_link}<br/>
{property_link}<br/>
]]>
</client:template>

<client:config id="example">
	<!-- more client configuration goes here -->
	<view id="com.cohga.client.panel.details">
		<location>west</location>
		<label>Details</label>
		<loadingText>Loading...</loadingText>
		<detail>
			<entity>property</entity>
			<datadefinition>dd_owner_details</datadefinition>
			<template ref="owner_details"/>
		</detail>
	</view>
	<!-- more client configuration goes here -->
</client:config>