Type (attribute of property)

From JRapid

Jump to: navigation, search

type is an attribute of property.



The data type that defines a property.

A property can be either of a built-in data type, such as string, integer or date, an image or file, or it may be an entity-type.

Each type has it's own autogenerated way of displaying and validating. You can change the way a property is displayed by changing the widget attribute.

If you don't specify a type, the default is the String type.

The type attribute sets the type of data that a property will be able to store. This may be a built-in data type, such as string, integer or date, or it may be an entity-type.

A property may take one of the following data types:

  1. Numeric
    1. id: All entities have an implicit autoincremental and primary key int field called id to identify each row. If a transient field named id is added to the entity, it will take the same value as the primary key.
    2. double
    3. float
    4. integer
    5. long
    6. boolean.
  2. Text
    1. string
    2. text
    3. longtext
    4. enum: each enumeration is added with a subelement of this property. See enum
  3. Dates
    1. date - Example value: 28/12/2010
    2. time - Example value: 15:30
    3. datetime - Example value: 28/12/2010 14:20
    4. timerange - Example value: 11:15 - 11:45
    5. timequantity - Example value: 3d 1h 15m
  4. Others
    1. file
    2. password
    3. image
    4. email
    5. phone
    6. url


<entity ...>
         name = NAME
         label = LABEL
         entity = ENTITY | type = TYPE


  • A property of type entity:
 <property display="primary" entity="Seller" label="Responsable" name="seller">

The default widget for entity-type properties is an HTML select element.

"image" widget
  • A property of type image:
 <property label="Image" name="logo" type="image"/>

Image-type properties are displayed as a small box with the image and a filechooser button.

"select" widget

  • When using price properties it is important to set them as double types so that they are not considered strings an calculations can be done with them.
<property name="price" label="Price" type="double" />

See also

Personal tools