Using listings
16/10/2008. German Gail
It's possible to create additional listings indicating what elements to display and how to display them. Moreover entities may have more than one listing. For more information about displayproperties see: How to use 'displayproperties'
We are going to introduce the multiple ways of declaring listings and show the multiple benefits of using them on our applications.
Let's see the next example:
<entity name="Contact" label="Contacto" menu="Contactos" defaultlisting="default">
<subset name="forCompany">
<param name="company" entity="Company" />
<condition field="company" value="company" />
</subset>
<listing name="forCompany" subset="forCompany" />
<listing name="default" view="icons,table,thumbnails" displayproperties="firstName,lastName;company,position,sector;contactPhoto"/>
<tab name="general" label="General">
<property name="company" label="Company" entity="Company" display="primary">
<action label="view contacts" type="relatedlisting" entity="Contact" listing="forCompany"
subset="forCompany" subsetparams="company"/>
</property>
<property name="firstName" label="Name" display="primary" />
<property name="lastName" label="Lastname" display="primary"/>
<property name="sector" label="Sector"/>
<property name="position" label="Position" display="primary"/>
</tab>
</entity>
The following image shows how the preview bar of the JRapid SDK looks like:
Clicking on the listing links (forCompany and default), the SDK will open the listing in the preview frame.
Using Listings to show subsets
One of the multiple uses the listing approach has is when you want to create a list for a particular subset.
...
<listing name="listingName" subset="subsetName" />
...
In the example above:
...
<listing name="forCompany" subset="forCompany" />
...
The result of clicking the action 'view contacts' is shown in the following image:
In the image it can be seen that the company selected is Proda and when you click on the view contacts action a new window pops up with the listing of all the contacts that belong to Proda.
Using listings to define the properties to show
Another approach is when you want to show other properties than the already included in the default listing. To accomplish this, the attribute you must use is displayproperties. For more information about displayproperties see: How to use 'displayproperties'
...
<listing name="general" view="icons,table,thumbnails" displayproperties="firstName,lastName;company,position,sector;contactPhoto"/>
...
The properties selected to be displayed are firstName, lastName, company, position, sector and contactPhoto. The ';' is used to separate the properties in different levels.
The properties in each level are going to be shown according to the selected type of view.
In the current example you can select through the frontend 3 different types of views (icons, table and thumbnails)
The thumbnail view:

The table view:
The incos view:

Comments
Where can I get more information?
matias@jrapid.com - 08/04/2009