List (value of collection)

From JRapid

Jump to: navigation, search

list is a value of collection.


Contents

Description

Lists, as opposite to sets and sortedsets, allow duplicate and null items. A list is an ordered collection. You may specify the sortable attribute to manually order the elements from within the form.

Usage

 <property 
    name = NAME
    label = LABEL 
    collection = "list" 
    extendable = "extendable"
    sortable = "sortable" 
    listindex = LISTI_INDEX
/>

Example

  • A company form may allow multiple comments entries:

The extendable attribute allows the user to add new entries.

 <entity label="Product" name="Product">
      ...
      <property collection="list" extendable="extendable" label="Comments" name="comments" type="text"/>
      ...
 </entity>

File:Listex.JPG

  • A product may have a list of images:

The extendable attribute allows the user to add new entries.

 <entity label="Product" name="Product">
        ...
        <tab label="Images" name="images">
            <property collection="list" extendable="extendable" height="100" label="Image"
            labelposition="top" name="image" type="image" width="100"/>
        </tab>
        ...
 </entity>
"extendable" example
  • Example of an embedded and sortable list:

You may also want to include a description next to the image. To do so, you should create and embedd a "ProductImage" entity which will contain both properties. Embedded lists properties must specify a listindex attribute which is used as the index for the listing.

 <entity label="Product" name="Product">
        ...
        <tab label="Images" name="images">
              <property childproperty="product" collection="list" embedded="inline" entity="ProductImage"
              extendable="extendable" height="100" label="Image" labelposition="top" listindex="index"
              name="image" sortable="sortable" width="100"/>
        </tab>
        ...
 </entity>
 <entity label="ProductImage" name="ProductImage">
        <property display="primary" label="Description" name="description" type="string"/>
        <property display="primary" height="100" label="Image" name="image" type="image" width="100"/>
        <property entity="Product" hidden="hidden" label="Product" name="product"/>
        <property hidden="hidden" label="Index" name="index" type="integer"/>
 </entity>
"listindex" example

See also

Personal tools