Usescript (element)

From JRapid

Jump to: navigation, search

usescript is an element, child of config, entity or panel.


Contents

Description

The usescript element is used to point to a script file to be loaded with the generated HTML files.

It is child element of the config, entity and panel elements and it may be automatically created when you import a view, widget or transformer.

If the element is placed as child of the config element, then every generated HTML file will include the reference to the JavaScript file.

If the element is used as child of an entity only the HTML files that correspond to that entity's UI will contain the reference to the JavaScript file.

When the element is placed as a child of panel the JavaScript file will be loaded when that panel is opened.

The location attribute specifies the location of the JavaScript file relative to the project's root folder. The external JavaScript file should be present in the specified location and must be added through the use of the JRapid Eclipse plugin.

Note that every JRapid project is created with a Main.js file in the /WebContent/Main/js/ folder
and that this file is included by default in every generated HTML file by the use of usescript.

This element creates a script HTML tag in the corresponding files with a reference to the external file.

Usage

<usescript
    location = LOCATION
/>

Example

  • Actions of type "javascript" need to import the JavaScript file that contains the associated function.
<app>
 <config>
     ...
     <usescript location="../js/realestate.js"/>
     ...
 </config>
</app> 


See also

Personal tools