Import file to use in MicroFocus IDMAPPS module's forms.
Current capabilities are to add a tabbed control inside an HTML control that emits events and callbacks per tab, as well as some functions to work with stand-alone picklists.
Main files:
- IAtools.js: Import file source code
- IAtools.min.js: Minified version of the code
- IAtools.js: Source map file for the minified version
- IAtools-test.xml: example IDMAPPS (User Application/RBPM) workflow using this import.
Kind: global namespace
- IAtools :
object- .tabCtrlFactory :
object- ~addTab(id, name, order, fieldlist, cb) ⇒
boolean - ~removeTab(id) ⇒
boolean - ~setCSSClassName(type, name) ⇒
boolean - ~setFieldEventName(fieldname, eventname) ⇒
boolean - ~getSampleCSS() ⇒
text/html - ~getTabHTML(uniqueID) ⇒
text/html
- ~addTab(id, name, order, fieldlist, cb) ⇒
- .picklistFnFactory :
object - .version() ⇒
string - .init(field, form, IDVault)
- .fieldVisibility(event, field) ⇒
undefined - .readAllPicklistOptions(fldName) ⇒
Object
- .tabCtrlFactory :
IDMAPPS tab control sub-module.
Kind: static namespace of IAtools
Example
var tabname = IAtools.tabCtrlFactory();- .tabCtrlFactory :
object- ~addTab(id, name, order, fieldlist, cb) ⇒
boolean - ~removeTab(id) ⇒
boolean - ~setCSSClassName(type, name) ⇒
boolean - ~setFieldEventName(fieldname, eventname) ⇒
boolean - ~getSampleCSS() ⇒
text/html - ~getTabHTML(uniqueID) ⇒
text/html
- ~addTab(id, name, order, fieldlist, cb) ⇒
Add tab to the internal storage. Underscore characters are NOT allowed as part of the ids since underscore will be used as a delimiter later. For order it is recommended to use large numbers to make it easier to insert new tabs in between any of the original ones without too much code changes/refactoring.
Kind: inner method of tabCtrlFactory
Returns: boolean - true if successful, false if invalid parameters are received or tab already exists
| Param | Type | Description |
|---|---|---|
| id | string |
Internal tab id |
| name | string |
Tab display name |
| order | number |
Tab sorting order. Lower is left-most, higher is right-most. |
| fieldlist | Array |
List of field(s) whose visibility and data are related to the added tab |
| cb | function |
Callback used when the tabs change. Will be called as tabs change with a 2 parameters: tab internal ID and string parameter. When a tab becomes active the second parameter is 'enter', when it becomes inactive the second parameter is 'leave'. |
Removes tab from the internal storage.
Kind: inner method of tabCtrlFactory
Returns: boolean - true if successful, false if invalid parameters are received or tab doesn't exist
| Param | Type | Description |
|---|---|---|
| id | string |
Internal tab id |
Allows to set the name of the CSS classes to be used when building the HTML code for the tabbed control
Kind: inner method of tabCtrlFactory
Returns: boolean - true if successful, false if any issues occurred.
| Param | Type | Description |
|---|---|---|
| type | string |
which base class name to change. Options are 'navbar', 'navitem', 'navactive' |
| name | string |
name of the CSS class to be applied when building the tabbed control |
Set the name of the visibility events per field name so that the tabbed control can show/hide the appropriated fields
Kind: inner method of tabCtrlFactory
Returns: boolean - true if successful, false if any issues occurred.
| Param | Type | Description |
|---|---|---|
| fieldname | string |
Name of the field (in Designer, not Web UI) |
| eventname | string |
Name of the visibility event to be called for show/hide |
Sample CSS style for the tabbed control to demonstrate its usage.
Kind: inner method of tabCtrlFactory
Returns: text/html - Style HTML tag with working basic style for the HTML tabbed control
Builds and returns the HTML code to be set on an IDMAPPS string/HTML form field.
Kind: inner method of tabCtrlFactory
Returns: text/html - Style HTML tag with working HTML tabs
| Param | Type | Description |
|---|---|---|
| uniqueID | string |
Unique ID set at the UL element of the tabbed interface |
Builds functions to manage items on picklist control. Allows developer to define functions that copy or move items between picklists, as well as ones that remove items from picklists. Allows to specify sorting and pass in a custom sorting function to be used by the picklist management function generated.
Kind: static namespace of IAtools
| Param | Type | Description |
|---|---|---|
| action | string |
Valid options are "add", "move" or "remove". Choose the basic functionality of the returned function. add -> Add the selections passed to the destination field; move -> Remove the selections passed from the Source field and add them to the destination field; remove -> Removes the selections passed from the Source Field. Destination field is not used with this action. If a item already exists in the destination field, code will highlight that entry instead of adding a second copy. |
| sort | boolean |
(Optional) true will sort the values for both source and destination fields. Defaults to false if not provided. |
| sortfn | string |
(Optional) if sort equals true, custom sort function to be used to sort the fields. Both source and destination fields are sorted with the same function |
Example
var addToPicklist = IAtools.picklistFnFactory( "add" );Example
var moveToPicklistWithSort = IAtools.picklistFnFactory( "move", true );Example
var removeCustomSort = IAtools.picklistFnFactory( "remove", true, function(a, b) { return a - b; } );Returned Function that performs picklist management as per parameters passed to picklistFnFactory.
Kind: inner method of picklistFnFactory
Returns: boolean - false if validation of parameters or task failed, true otherwise.
| Param | Type | Description |
|---|---|---|
| selections | string/array |
String or Array with values to be moved from source to destination field |
| srcFieldName | string |
Name of the source field being read/modified |
| destFieldName | string |
Name of the destination field being read/modified |
Module version and requirements
Kind: static method of IAtools
Returns: string - Module's version
Initializes references to the IDMAPPs framework objects and save the same in the internal storage
Kind: static method of IAtools
| Param | Type | Description |
|---|---|---|
| field | object |
IDMAPPS framework field object |
| form | object |
IDMAPPS framework form object |
| IDVault | object |
IDMAPPS framework IDVault object |
When added in the event section of a form field, allow us to show and hide that field by using field.fireEvent( event-name, action ); Where event-name is the event's name and action is either 'show' or 'hide'
Since the field visibility functions only exist inside the field context we need to pass both objects from where the function is being called to use them inside that scope/context. Inside the event we just need to add the line: IAtools.fieldVisibility( event, field ); to properly use this function. No need to change anything on the line above, it is already passing the event and field objects as seen in the scope of that particular form field.
Kind: static method of IAtools
Returns: undefined - Changes the field visibility, no return value provided.
| Param | Type | Description |
|---|---|---|
| event | object |
event object as seen by the field's scope |
| field | object |
field object as seen by the field's scope |
Reads a picklist field in RBPM and retrieves all its values/options. This is necessary since the RBPM standard API only lets us retrieve selected values, not the whole list of available ones.
Kind: static method of IAtools
Returns: Object - Returns an object with the format { 'data':[ picklist data ], 'display':[ picklist display values ] }
| Param | Type | Description |
|---|---|---|
| fldName | string |
Name of the picklist control field as displayed in Designer. |