Widget (attribute of actiongroup)

From JRapid

Jump to: navigation, search

widget is an attribute of actiongroup.


The widget defines the way an actiongroup is rendered, on its location.

Different locations may render the same widget slightly different (for example, in the 'local' location, where there's less space, widgets should be lower than in the 'listing' location).

Take a look at the image to visually identify the different widgets.

Note: If widget is not defined, select is taken as the default value.

Available widgets are:

Renders the actiongroup as an HTML SELECT element, whose OPTIONs are the children actions.
Children actions widgets are ignored, as they can only be rendered as plain HTML OPTIONS
If label attribute is present, the label is rendered as the first OPTION.
Renders the actiongroup as an HTML DIV element, holding the children actions inside.
This widget can use the action's widget (if set), and otherwise, use the the default widget for the action in a 'div' group: 'button'.
If label attribute is present, the label is rendered as a fieldset.

NOTES (for client side developers): both widgets' top level element is a DIV:

  • in widget=div, it's the DIV itself that holds the children actions, with class=jrapid_actiongroup_{location}_div.
  • in widget=select, there's a DIV with class=jrapid_actiongroup_{location}_select surrounding the SELECT element that holds the actions.


The code below was used to generate the entity in the image above.

    <entity name="WikiActiongroupWidget" label="Actiongroup Widgets" menu="wiki" >
    	<property name="name" label="Name" display="primary" />
    	<property name="company" label="Company" entity="Company" display="primary" />
        <actiongroup name="actiongroupSelect" label="Widget Select (default)"   
            widget="select" location="listing">	
            <action name="action01" label="action 01" 
   		type="javascript" function="testJavascriptAction" functionparams="'action 01'" />
            <action name="item02" label="action 02"
        	type="javascript" function="testJavascriptAction" functionparams="'action 02'" />
            <action name="newCountryCompany" label="New Country company" 
        	type="relatedentity" entity="Company" defaultset="forCountry" />
        <actiongroup name="actionGroupDiv" label="Widget Div"   
       	    widget="div" location="listing">
       	    <action name="item03"  label="action 03"
                type="javascript" function="testJavascriptAction" functionparams="'action 03'" />
            <action name="item04"  label="action 04"
        	type="javascript" function="testJavascriptAction" functionparams="'action 04'" />			

In line 6, if you do not put the "select" value of the "widget" attribute explicitly, you'll get the same output.

Notice also that:

  • the actiongroups' location attribute is set to "listing".
  • actions (children of the groups) do not set its widget:
    • actiongroup widget DIV: children's default widget is "button"
    • actiongroup widget SELECT: children widget is ignored, and they are always rendered as HTML OPTIONS.
  • and neither do they define a location, because it's set by the actiongroup.

See also

Personal tools