Widget (attribute of property)

From JRapid

Jump to: navigation, search

widget is an attribute of property.


Contents

Description

A widget defines the way a property is displayed on a form. Different type of widgets are available depending on the data type of a property.

Existing entity-type property widgets:

  • select widget (default).
  • combo
  • radio widget.
  • selectmultiple widget (only collections of entities) (default).
  • checkbox widget (only collections of entities).


Additionally, widget add-ons are available from the JRapid Community. These can be imported into your project or you can build your own.

Usage

<property
   label = LABEL
   name = NAME
   entity = ENTITY
   type = TYPE
   widget = WIDGET 
   ...
/>


Example

  • Widget "select":

Let's suppose we have "Company" entity with a responsible property of type "Seller". The default widget for entity-type properties is the "select" widget (see image below).

 <entity label="Company" menu="Company" name="Company">
     <property label="Responsible" name="responsible" entity="Seller"/>
 </entity>
 <entity label="Seller" menu="Sellers" name="Seller">
     <property display="primary" label="First Name" name="firstName"/>
     <property display="primary" label="Last Name" name="lastName"/>
 </entity>
Widget "select" example


  • Widget "radio":
 <property label="Responsible" name="responsible" entity="Seller"  widget="radio"/>
Widget "radio" example


  • Widget "combo":

The combo (value of widget) displays a standard text box field that allows the user to type in it and suggests records that comply with the search criteria defined for the widget, such as "starts with". The widget can be triggered when typing something in the text field or by double clicking on it. When a value is typed, the widget displays a set of results from which the user may select one.

In this example, we are filtering the Seller by their last name, so the comboproperty is "lastName" and we created a filter in the "Seller" entity that filters by lastName. JRapid will find a comboproperty named "lastName" and will search inside "Seller" for a filter named "lastName", so make sure they have the same name.

 <entity label="Company" menu="Company" name="Company">
     <property label="Responsible" name="responsible" entity="Seller" widget="combo" comboproperty="lastName" />
 </entity>
 <entity label="Seller" menu="Sellers" name="Seller">
     <property dimension="row" display="primary" label="First Name" name="firstName" required="required"/>
     <property display="primary" label="Last Name" name="lastName" required="required"/>
     <filter display="primary" flag="like" label="lastName" name="lastName" property="lastName"/>
 </entity>


Widget "combo" example‎


  • Widget "checkbox" and "selectmultiple"

For properties of type collection, other widgets are available for you to use. The "selectmultiple" widget, which is the default, and "checkbox" widget. You will prefer to use "checkbox" widget when there are a few items in the collection, otherwise you will get a large list of check boxes in the form making it very little user friendly.

 <entity label="Opportunity" menu="Opportunity" name="Opportunity">
        ...
        <property name="company" label="Company" entity="Company" />
        <property collection="set" entity="Contact" label="Contacts" name="contacts"
        subset="forOpportunity" subsetparams="company" />
        ...
 </entity>
 <entity label="Contact" name="Contact">
        <property display="primary" label="First Name" name="firstName" />
        <property display="primary" label="Last Name" name="lastName" />
        <property display="secondary" label="Company" name="company" entity="Company" />
        ...
        <subset name="forOpportunity" ... >
            ...
        </subset>
 </entity>
  • Widget "selectmultiple":
Widget "selectmultiple" example


  • Widget "checkbox":


Widget "checkbox" example

See also

Personal tools