...
The following is a basic example of the details panel
Code Block |
---|
| xml | xml |
---|
title | Details panel generating default templates |
---|
linenumbers | true |
---|
| xml |
---|
|
<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 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.
Code Block |
xml |
---|
| xml |
---|
title | Details panel with a template |
---|
linenumbers | true |
---|
| xml |
---|
|
<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>
|
...
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.
Code Block |
xml |
---|
| xml |
---|
title | Details panel with modified text |
---|
linenumbers | true |
---|
| xml |
---|
|
<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)
Code Block |
xml |
---|
| xml |
---|
title | Details panel with a template |
---|
linenumbers | true |
---|
| xml |
---|
|
<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>
|