You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 11
Next »
Usage
- Plugin Properties Options allow a plugin to gather configuration data from a plugin user.
- Plugin Properties Options should be returned in the abstract method "getPropertyOptions" of each plugin.
Structure
- Plugin Properties Options are in JSON format.
- Plugin Properties Options is an array of Properties Page object
- A Properties Page object has 2 mandatory attributes called "title" and "properties". It also has 2 optional attributes called "validators" and "buttons".
[
{
title : 'Page Title',
properties : [
{
name : 'Property Name',
label : 'Property Label',
description : 'Property Description', //optional, default is NULL
type : 'Property Type',
value : 'Property Value', //optional, default is null
required : 'Mandatory or Not', //optional, boolean value, default is false
//… more attributes …
}, //… more fields …
],
validators : [ //optional
//… properties custom validators …
],
buttons : [ //optional
//… custom properties page buttons …
]
}, //… more properties page …
]
Field Types
Check Box
Code Editor
- type : 'CodeEditor'
- mode : Optional, used for specified highlight mode. Default to "text", available values are "text", "java", "html", "javascript", "css", "json", "sql" and "xml".
- Refer to Retrieve Properties Value in Plugin - Single Value Field on how to use the value of this field type in the plugin code.
Combine Grid
- type : 'GridCombine'
- Refer to Grid Related Attributes for extra attributes.
- Combine Grid is used to migrate 2 or more single value property fields (etc Text Field & Select Box) to multi values field in Grid View.
- Refer to Retrieve Properties Value in Plugin - Combine Grid Field on how to use the value of this field type in the plugin code.
Element Select Box
- type : 'ElementSelect'
- url : a URL which will return Properties Option JSON object of the selected element. Built-in URL is "[CONTEXT_PATH]/web/property/json[APP_PATH]/getPropertyOptions" which will return the Properties Option JSON object of a plugin.
- Refer to Option Field Attributes for extra attributes.
- Usually used for select a plugin and configure the properties of the selected plugin.
Fixed Row Grid
Grid
Hidden Field
HTML Editor
Label
Multi Select Box
Password Field
Readonly Field
Select Box
Text Area
Text Field
Dependency Field Attributes
Options Field Attributes
- The following attributes are designed for options fields like Check Box, Element Select Box, Multi Select Box, Radio Button and Select Box.
- You can choose to use one of the following attributes "options", "options_ajax", "options_callback" or "options_script" to populate the options for the field.
options : Optional, an array of JSON object with 'value' and 'label' attributes.
options : [
{value: 'value1', label : 'Value 1'},
{value: 'value2', label : 'Value 2'},
{value: 'value3', label : 'Value 3'}
]
options_ajax : Optional, a URL which will return an array of JSON object with 'value' and 'label' attributes.
options_ajax : '[CONTEXT_PATH]/web/json/console/app[APP_PATH]/datalist/options'
options_ajax_on_change : Optional, name of a property field. Used together with 'options_ajax' attribute. The field name and its value will passed as HTTP request parameter to the URL.
options_ajax_on_change : 'type'
options_ajax : '[CONTEXT_PATH]/web/json/app[APP_PATH]/plugin/org.joget.plugin.enterprise.SamplePlugin/service?action=getJson'
options_callback : Optional, a javascript function name. All attributes in the field will passed as a single JSON object parameter to this function. The function should return an array of JSON object with 'value' and 'label' attributes.
options_callback: 'DatalistBuilder.getColumnOptions'
options_script : Optional, a string of javascript which will return an array of JSON object with 'value' and 'label' attributes.
options_script: 'var tempArray = [{\'label\':\'\',\'value\':\'\'}];
for(ee in DatalistBuilder.availableColumns){ var temp = {
\'label\' : UI.escapeHTML(DatalistBuilder.availableColumns[ee].label),
\'value\' : DatalistBuilder.availableColumns[ee].id};
tempArray.push(temp);}tempArray;'
Built-in JSON API for 'options_ajax'
- [CONTEXT_PATH]/web/json/console/app/[APP_PATH]/forms/options
Return all available forms of current app. - [CONTEXT_PATH]/web/json/console/app/[APP_PATH]/datalist/options
Return all available datalists of current app. - [CONTEXT_PATH]/web/json/console/app/[APP_PATH]/userview/options
Return all available userviews of current app. - [CONTEXT_PATH]/web/property/json/getElements?classname={plugin interface/abstract class name, optional}
Return all available plugins based on the classname filter.
Built-in Javascript Function for 'options_callback'
Validator Types
AJAX
Page Button
Variable
[CONTEXT_PATH]
- This variable will be replaced by Context Path of current URL.
- Usually used in property attribute value which is URL
- Example : '[CONTEXT_PATH]/web/property/json/getElements?classname=org.joget.apps.form.model.FormValidator'
- Resulted URL : '/jw/web/property/json/getElements?classname=org.joget.apps.form.model.FormValidator'
[APP_PATH]
- This variable will be replaced by Current App Id and App Version of current URL.
- Usually used in property attribute value which is URL
- Example : '[CONTEXT_PATH]/web/json/console/app[APP_PATH]/datalist/options'
- Resulted URL : '/jw/web/json/console/app/crm/3/datalist/options'
Retrieve Properties Value in Plugin
Single Value Field
Multi Values Field
Combine Grid Field
Grid Field
Element Select