Listview

You can see what a list view looks like by looking in the transformations - the methods of a transformation are not shown in the tree structure there, but in a list above the form field. This view can also be used for the content. For this setting there is the configuration file childrenListViews.config

In the following example, a view for users in groups is created in this way. The advantage is that, if you wish to administrate a large number of users, the tree structure on the left-hand side expands considerably. In addition, the list view offers the possibility of having information about an information object shown, for example the contact details in the case of a user, meaning that there is no longer the need to look at the form of the information object.



  <listView schemaLocation="http://www.getit.de/2007/board/groups">
    <columns order="name#ascending">
      <column id="name" dataType="xs:string" />
      <column id="nickname" dataType="xs:string" />
      <column id="mail" dataType="xs:string" />
    </columns>
    <childType schemaLocation="http://www.getit.de/2007/board/user" handleDerivations="true" structureInvisible="false">
      <column ref="name" select="concat(user/firstname, ' ' , user/lastname)" />
      <column ref="nickname" select="user/nickname" />
      <column ref="mail" select="user/mail" />
    </childType>
  </listView>

List view for users

In the example a user list is defined which is displayed when you click on an information object group. The name, user name and email address of a user are to be indicated in the list.

As a first step, the columns are defined for this purpose, this means an ID via which the columns are addressed and the data type for this column.

Next, the relevant user data is then allocated to the columns. The ID that has just been assigned is linked to here and the data is provided by means of XPath expression.

There are now two further attributes for childType.

The attribute “structureInvisible” hides the users in the tree structure in the case of “false”. If the attribute is not set, the default value is “true” and the objects are shown in the tree structure accordingly.

“handleDerivations” now specifies whether derivations of a type are to be shown in the list or not. For example, there is a user derivation “guest” which has no name or contact details. Since this missing data is required for displaying in the list, this attribute is set to “false” and then all derived objects are only shown in the tree structure.

The headers of the columns are the IDs assigned in the configuration file. It is explained how to adapt these in the section “Language”.



<childType schemaLocation="http://www.getit.de/2007/board/user" handleDerivations="true" structureInvisible="true">
    <column ref="icon" select="onion:createIcon($onion:id, icon, 32, 32, 'title')" />
    <column ref="name" select="$onion:name" />
    <column ref="name" select="onion:getName(user)" />
    <column ref="gender" select="onion:choose(gender = 'male', 'male', 'female')" />
    <column ref="" select="onion:getDataObject(user)/user/firstname" />
</childType>

Example: Data access

In the ListViews, extended information can also be shown as well as the data from the dataset.

The example above shows all available variables and functions.

Variablen:
$onion:id
$onion:name
$onion:parent
$onion:creator
$onion:dateCreated
$onion:editor
$onion:lastModified
$onion:version

Functions:
onion:createIcon        creates an icon. The ID of the element, the method, height, width and a title must be indicated here.
onion:getName           returns the name of the transferred element
onion:choose             returns a value depending on the condition (same function as “c.choose()”)
onion:getDataObject   retrieves an object such as c.dataCall (id, 'content')