[Global] getFileInfo(options)

Returns info about a file and FileVersions.

Parameters:
Name Type Description
options object Options object.
Properties
Name Type Description
fileId number Id of file
success function function(fileInfo) called after the info about the file is retrieved. fileInfo is an object
fileInfo object
Properties
Name Type Description
Id number Id of the file
UId string UId of the file
IsTempFile bool Indicates whether its a temporary file
Versions array Array containing info about all versions of the file
Properties
Name Type Description
Id number Id of the FileVersion
UId string UId of the FileVersion
Version int Version of the FileVersion
IsCurrent bool Indicates whether its a temporary FileVersion of the file
FileName string Filename of the FileVersion
CreatedBy int Id of the user who created the FileVersion
CreateTime string Timestamp for creation of the FileVersion
Size int Size (in bytes) of the FileVersion
CurrentVersion object Object containing info about the current FileVersion of the file (Same as in the Versions array)
Example
getFileInfo({
             fileId: omada.configurationChangeImport.settings.fileId,
           success: function (fileInfo) {
                showMessageDlg(S_COMMON_Text_DlgTitle_Message, "File Name: " + fileInfo.CurrentVersion.FileName);
            }
        });

Namespace: appPage

The functions in omada.appPage are available in all web pages that inherit from AppPage.

Methods

(static) addPageInfo(options)

Adds an info text in the top of either: a global page, a frame dialog page or a dhtml popup dialog
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
message string Message html - if not specified no message is added (can be useful if you only want to remove a message)
msgType string Type of message [Info, Warning, Error, Success]. Default is 'Info'.
msgId string Optional id assigned to the message. If a message has already been added with the same id then it is removed first.
width string NOT USED
containerId string (optional) If info text should be added to a specific container, then the id should be specified
dialogId string (optional) If info text is to be added to a dhtml popup dialog then the id of it should be specified here.
Example
omada.appPage.addPageInfo({ message: 'Hello world', msgType: 'Info' });

Namespace: dashboard

The functions in omada.dashboard are for displaying a Dashboard.

Methods

(static) registerWidget(options)

Registers a Widget to be used for setting up a Dashboard.
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
name string Name of pre-registered widget.
initialize function Callback: function(options) - Is called by the Dashboard setup prior to any rendering.
render function Callback: function(options) - Is called when the Widget must render itself.
Properties
Name Type Description
widgetId string Id of element that the Widget must render within.
headerId string Id of element containing the Widget header.
width number Width of the Widget canvas (in pixels).
height number Height of the widget canvas (in pixels).
params string Custom object with specified parameters for the specific Widget.
widget object The options object for the specific Widget.
resize function Callback: function(options)
Properties
Name Type Description
widgetId string Widget Id.
widgetWidth number Width of the widget in pixels.
widgetHeight number Height of the widget in pixels.
setupWidgetGroupedByCategory function Callback: function(options) - It is called when widget needs to be rendered grouped by categories
Example
// Registration of a "PageViewer" dashboard widget.
            // renderOptions.params:
            //   .pageUrl: url of the page to display
            omada.dashboard.registerWidget({
              name: 'PageViewer', render: function (renderOptions) {
                var frameTag = '<iframe src="' + renderOptions.params.pageUrl + '" style="width:' + renderOptions.width + 'px; height:' + renderOptions.height + 'px;">';
                $('#' + renderOptions.widgetId).html(frameTag);
              }
            });

Namespace: dataObjectDialog

The functions in omada.dataObjectDialog are available in all Data Object Forms and Work Item Forms.

Methods

(static) getFormData(options) → {object}

Gets the data displayed in the form. Returns a dictionary object where keys are property system names and values are objects.
Parameters:
Name Type Description
options object Options object - currently unused.
Returns:
Returns a dictionary object where keys are property system names and values are objects with:
.propType -
.dataType -
.ctrlType -
.singleValue - Corresponds to .value of the first entry in the values array
.singleDisplayValue - Corresponds to .displayValue of the first entry in the values array
.values - Array of objects with .value and .displayValue
Type
object

(static) modifyField(options)

Modifies one or more Form Fields.
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
property string | array Property System Name or array of multiple Property System Names. The fields representing the properties will be affected (required).
hide bool If true the fields will be hidden - if false they will be unhidden. Ignored if null.
readOnly bool If true the fields will be made readonly/disabled - if false they will be editable/enabled. Ignored if null.
reqValue bool If true the fields will be marked as 'requires value' - if false they will be unmarked. Ignored if null.
value object New value or array of values for the field(s). Each value is an object with .value and .displayValue.
Properties
Name Type Description
value object Value (Ref.property: dataobjectid, Set property: propertyvalueid, Date property: Date object)
displayValue object Display value used for set- and reference-values.
Example
omada.dataObjectDialog.modifyField({ property: ['NAME'], hide: false, value: { value: 'some name' } });
omada.dataObjectDialog.modifyField({ property: ['MANAGER'], value: [{ value: 3502, displayValue: 'System Administrator' }] });

Namespace: dialogHelper

The functions in omada.dialogHelper are for working with the jQuery UI dialog API and for using various dialogs.

Members

(static) quickforms

Shows a "quick form" dhtml-popup for editing an object.

The form is configured with a set properties. It doesn't, however, depend on a data object type and it doesn't load and save to the data object repository.

Not all kinds of properties are allowed - it depends on the data type and control type used.

Example
var properties = [];
properties.push({ name: 'Name', propertyName: 'NAME', caption: 'Name', requiresValue: true });
properties.push({ name: 'Description', propertyName: 'DESCRIPTION', caption: 'Description', requiresValue: true });
omada.dialogHelper.showQuickFormDlg({
  formId: 'MyQuickForm',
  properties: properties,
  caption: 'Please enter name'
});

Methods

(static) configureTree(options)

Configures a jQuery dhtml tree structure.
Parameters:
Name Type Description
options object Options object.
Properties
Name Type Description
roots array array of tree root node objects:
Properties
Name Type Description
id string node identifier
title string The dialog title whic will be displayed in the tree
selectable bool Is the user allowed to select the object in the dialog?
icon string Icon filename (example: 'images/appicons16/element.png')
tag string Optional info which is delivered to the demandLoad function as .tag
state object optional - Default state of the node
Properties
Name Type Description
opened bool Is the node open
disabled bool Is the node disabled
selected bool Is the node selected
contextmenu array Array of context menu items
demandLoad function Callback function(options) called by the dialog when a node is expanded by the user and children needs to be loaded
Properties
Name Type Description
options number Options object for the callback
Properties
Name Type Description
id number Id of the node that has been expanded
ancestors array Array of all ancestors - root is in index 0. Each ancestor object has:
Properties
Name Type Description
id number Node id of the ancestor
tag string Tag of the ancestor
tag string optional info that was specified to loadCompleted by (a previous call to) demandLoad
treeTag string optional object with info that was specified in the options.tag for the tree
treeOptions string the options originally provided to the tree function
loadCompleted function Callback function(result) that must be called by the demand load function when the data is loaded
Properties
Name Type Description
result object The result of the demand load
Properties
Name Type Description
objects array Array of loaded objects:
Properties
Name Type Description
id number Id of the node to be added
title string Value to be displayed for the node in the tree
selectable bool Is the user allowed to select the node in the dialog?
canExpand bool Can the user expand the node in the tree?
icon string Icon filename (example: 'images/appicons16/element.png')
tag string Optional object with node-info which is delivered to the demandLoad function as .tag
onClick string Optional name of a JavaScript function being called when the cell i clicked. The function get the id as the only parameter. The object must be selectable.
state object Optional - Default state of the node
Properties
Name Type Description
opened: bool Is the node open
disabled bool Is the node disabled
selected bool Is the node selected
tag string optional - info which is delivered to the demandLoad function as .treeTag
Example
var roots = [];
roots.push({ id: 1, title: 'My tree root', icon: 'images/appicons16/folder.png' });
omada.dialogHelper.configureTree({
  title: 'My tree dialog',
  roots: roots,
  demandLoad: function (parent) {
    var objects = [];
    objects.push({ id: 2, canExpand: false, title: 'my tree child', icon: 'images/appicons16/folder.png' });
    parent.loadCompleted({ objects: objects });
  },
});

(static) debounce(func, wait)

Prevent function from being called more frequent than specified interval to avoid too many function calls on key down, scroll events etc.
Parameters:
Name Type Description
func object function
wait number time inteveral

(static) showAccordionDialog(options)

Shows a modal DHTML dialog with an accordion control each panel header can be accessed through the DOM via the id {containerId}_header_{panelId} each panel can be accessed through the DOM via the id {containerId}_panel_{panelId}
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
containerId string Id of div container which will be created to hold the dialog (html)
dialogTitle string Title of the dialog
dialogContent string Content to show in the dialog above the accordion
heightStyle string "auto": All panels will be set to the height of the tallest panel. "fill": Expand to the available height based on the accordion's parent height. "content": Each panel will be only as tall as its content.
height number Height of the dialog window
width number Width of the dialog window
panels array Array of panels to show in the accordion
Properties
Name Type Description
id string Panel id
title string Panel title
icon string Icon to show before the title
sections.content string Panel content (html)
nonModal bool If true the dialog will be non-blocking. By default is is blocking
buttons array Array of buttons to be shown in the dialog.
Properties
Name Type Description
text string Button caption.
click: function function activated on click.
onOpen: function function activated on click.
onClose: function function(event) called when the dialog is closed
onActivate: function function(event, ui) Triggered after a panel has been activated (after animation completes).
resizeStop: function function(event, ui) binds to resizeStop event of the dialog If the accordion was previously collapsed, ui.oldHeader and ui.oldPanel will be empty jQuery objects. If the accordion is collapsing, ui.newHeader and ui.newPanel will be empty jQuery objects.
allowMultipleOpenPanels bool If true, multiple panels can be unfolded
Example
omada.dialogHelper.showAccordionDialog({
  containerId: 'myAccordionDlg',
  dialogTitle: 'Accordion dialog',
  dialogContent: "This is an accordion dialog",
  panels: [
  {id: "panel1", title: "Panel1", content: "Hello panel1"},
  {id: "panel2", title: "Panel2", content: "Hello panel2"}
  ]
  });

(static) showConfirmation(options)

Shows a modal confirmation dialog with OK/Cancel buttons. The dialog doesn't block the program flow.

To resume the program flow when the dialog closes implement the onClick function in the options.

Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
message string Content of the message dialog
title string Windows title for the dialog
nonModal bool If true, the confirmation will not be shown as a blocking dialog
htmlEncode bool Html encode the message?
convertCRtoBR bool If true, the carriage returns characters in the message will be converted to html breaks.
okClick function Callback: function(aSelectedItems, aSelectedObjects) - is called when "Ok" has been clicked in the dialog and at least one item is selected.
cancelClick function (Optional) Callback: function() - is called when "Cancel" has been clicked in the dialog
disableForcedClose bool If true, it will not be possible to close the dialog using the escape key. The close button in the top-right corner of the dialog will also be hidden
height number Height of the dialog window
width number Width of the dialog window
Example
omada.dialogHelper.showConfirmation({
  title: 'Input required',
  message: 'If you click OK, the data will be submitted for approval',
  okClick: function () { closeDialog(CDR_Ok); }
});

(static) showCopyRuleSelectionDialog(options)

// Shows a grid selection dialog for selecting copy rules // options:
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
sourceDataObjectTypeId array -
targetDataObjectTypeId array -
negIds array Array of copy rule Ids. If specified those copy rules will not be displayed in the grid
multiSelection bool If true, the user is allowed to select multiple data object types.
showNewButton bool If true the selection dialog will include a button to create a new copy rule
selectionCompleted function Callback function(selectedIds, selectedRows) to be called when "Ok" has been pressed in the dhtml dialog and at least one item is selected.
Properties
Name Type Description
selectedIds array Array of the ids of the selected rows in the grid
selectedRows object Object with array of items.
Properties
Name Type Description
items array Each item in the array has a field corresponding to a column name in the grid.
Properties
Name Type Description
id number The ID of the selected copy rule
name number The name of the copy rule
uid string The uid of the copy rule
readOnly bool If true the dialog is shown in read-only mode with the following impact:
    - A 'close' button is shown instead of OK/Cancel.
    - .multiSelection and .selectionCompleted are ignored.
title string The title on the dialog popup.

(static) showDataObjectQuickFormDlg(options)

Shows a "quick form" dhtml-popup showing the details of a data object.
Parameters:
Name Type Description
options object Options object.
Properties
Name Type Description
divId object Desired DOM id of the dhtml form
dataObjectId object Id or UId of a DataObject
formId object Id or uid of a DataObject Form (optional). If not specified the default DOT form is used
caption object Caption on the dialog popup
beforeShow function Callback function(formData) called right before the dialog is shown
Properties
Name Type Description
formData object Object provided to the callback
Properties
Name Type Description
dlg object Dialog object
ctrlIds object Object where each field name is a Property SystemName and the value is the control id
nonModal bool Do not show the dialog in modal mode
width number Width of the dialog (in pixels)
height number Height of the dialog (in pixels)
Example
omada.dialogHelper.showDataObjectQuickFormDlg({ dataObjectId: '60CCEC0C-DAD1-4DF8-BB09-C77F15029FCD', divId: 'dataObjQuickForm', width: 500})

(static) showDataObjectSelectionDialog(options) → {object}

Function shows a DHTML dialog for selecting Data Objects from a grid. A Data Object View is used for configuring columns and filtering.
Parameters:
Name Type Description
options object Options object.
Properties
Name Type Description
lookupViewId number | string Id or UId of the Data Object View used to filter data and format columns.
objectIds array Array of Data Object Ids. If specified only those objects will be displayed in the grid. Deprecated: Use options.expressions instead.
negIds array Array of Data Object Ids. If specified those objects will not be displayed in the grid. Deprecated: Use options.expressions instead.
referrerIds array Array of Data Object Ids. Only include Data Objects that are referred by one or more of these Data Objects via a Reference Property. Deprecated: Use options.expressions instead.
referredIds array Array of Data Object Ids. Only include Data Objects that has a reference to one or more of these Data Objects via a Reference Poperty. Deprecated: Use options.expressions instead.
multiSelection bool Allow the user to select multiple Data Objects?
selectionCompleted function Callback: function(aSelectedItems, aSelectedObjects) - is called when "Ok" has been pressed in the dialog and at least one item is selected.
Properties
Name Type Description
aSelectedItems array An array of the Ids of the selected Data Objects.
aSelectedObjects array An array of the selected Data Objects.
Properties
Name Type Description
id number Id
displayName string Display Name
readOnly bool If true the dialog is shown in read-only mode with the following impact:
- A 'close' button is shown instead of Ok/Cancel.
- No grid toolbuttons are shown.
- selectionCompleted is ignored
title string Dialog title. If not specified the view name will be used.
pageContext string Text string which will be passed on to the AccessModifier specified on the Data Object View (if any) in the parameter _PAGECONTEXT.
width int An option to specify the width of the grid. Can be used when the dialog title is wider than the grid. By default the width is calculated.
expressions array Array of expression objects which are used for filtering the Data Objects shown in the grid.
Properties
Name Type Description
path string Reference path from the Data Objects in the view to the Data Object that the expression is for.
property string Property/fixed field to filter on.
operator string Operator [Equals, LessThan, GtThan, LessThanEq, GtThanEq, NotEquals, Like, In, NotIn]
value Filter value for the expression. Can be either a: string, bool or array. An array (of string) is valid if the property is a Set- or Reference-property. It can then specify Data Object Ids or UIds. If the property has data type DateTime the filter value must be a DateTime in xml format.
extraButtons array Array of additional UI Actions to be shown in the toolbar above the grid.
Properties
Name Type Description
caption string Button caption.
img string jQuery UI img name. Example: 'ui-icon-plus'. Find supported icons here: http://jqueryui.com/themeroller/
tooltip string
clickEvent function Parameter-less function activated on click.
userGroupOptions object Object with options related to user groups. The options are only used if the view filters (exactly) on user groups.
Properties
Name Type Description
memberGroupIds array Array of user group ids. Only personal user groups belonging to users, who are member of the all the groups specified, will be included.
grpIncludes array Array of strings on format: [user group id]:[0-3] where the number 0-3 means: None=0, GroupOnly=1, MembersOnly=2, Both=3
excludePersonal bool Exclude personal user groups?
excludeSystem bool Exclude user groups marked as "system" objects?
includeSystemUser bool Include the personal user group for the "System" user?
includeDummies bool Include the built-in "dummy" user groups?
includeProcessCreator bool Include the built-in generic "process creator" user group?
includeProcessOwner bool Include the built-in generic "process owner" user group?
excludeEveryone bool Exclude the "Everyone" user group?
includeActiveUser bool Include the built-in generic "active user" user group?
excludeNoneGroup bool Exclude the "None" user group?
assigneeMode bool Go into assignee selection mode? (bool). Requires that the view filters exactly on users and user groups.
assigneeOptions object Object with options related to assignees. The options are only used if assigneeMode is used.
Properties
Name Type Description
memberGroupIds array Array of user group ids. Only users, who are member of the all the groups specified, will be included.
grpIncludes array Array of strings on format: [user group id]:[0-3] where the number 0-3 means: None=0, GroupOnly=1, MembersOnly=2, Both=3
beforeShow string function(args) - fires before the dialog is shown.
beforeSelectRow bool : function fires when the user click on a row, but before the row is selected.
uiActions array Array of UI action style buttons to place above grid
Properties
Name Type Description
btnId string Button id
caption string Button caption
disabled string should button be disabled
clickData: string optional object that is available in the clickHandler's e.data
clickHandler string function(e)
isSecondary string button is secondary and will be placed in more menu
Returns:
Returns an object:
.dialogId - Id of the dialog.
.gridId - Id of the grid (in the dialog).
.getSelItems - Function (parameterless) that returns an array with the selected ids in the grid.
.getSelObjs - Function (parameterless) that returns an array with the selected Data Objects in the grid. Each object has a .id and .displayName.
Type
object
Example
omada.dialogHelper.showDataObjectSelectionDialog(
{
  lookupViewId: '2E03DE34-75C4-4C61-8F84-0156F094677D',
  multiSelection: true,
  selectionCompleted: function (aSelectedItems, aSelectedObjects) {
    for (var i = 0; i < aSelectedObjects.length; i++)
      showMessageDlg(S_COMMON_Text_Warning, 'Selected object with index ' + i + ' has id ' + aSelectedObjects[i].id + ' and display name "' + aSelectedObjects[i].displayName + "'");
  }
});

(static) showDataObjectTypeSelectionDialog(options)

Shows a jQuery grid dhtml selection dialog for selecting data objects types.
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
includeShadowDataObjectTypes bool If true, Shadow Data Object Types are loaded alongside the regular ones.
negIds array Array of data object type ids. If specified only those objects will not be displayed in the grid.
multiSelection bool If true, the user is allowed to select multiple data object types.
selectionCompleted function Callback function(selectedIds, selectedRows) to be called when "Ok" has been pressed in the dhtml dialog and at least one item is selected.
Properties
Name Type Description
selectedIds array Array of the ids of the selected rows in the grid
selectedRows object Object with array of items.
Properties
Name Type Description
items array Each item in the array has a field corresponding to a column name in the grid.
Properties
Name Type Description
_id number The ID of the selected item
id number The ID of the selected type
icon number The icon file for the selected item
number number The number of the selected item
name number The name of the selected type
description number The description of the selected item
systemName number The system name of the type
readOnly bool If true the dialog is shown in read-only mode with the following impact:
    - A 'close' button is shown instead of OK/Cancel.
    - .multiSelection and .selectionCompleted are ignored.
title string The title on the dialog popup.
Example
omada.dialogHelper.showDataObjectTypeSelectionDialog(
{
  selectionCompleted: function (aSelectedItems, aSelectedRows)
  {
    showMessageDlg(S_COMMON_Text_Warning, 'selected type id: ' + aSelectedItems[0]);
  }
});

(static) showDataSourceSelectionDialog(options)

// Shows a dialog with grid for data source data // options:
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
dataSourceName string name of the query
title string dialog title
totalCount int total count of data if present

(static) showDialog(options)

Shows a simple modal DHTML dialog which can be used to show text/html content
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
title string Title (text) of the message dialog (window title)
containerId string Id of div container which will be created to hold the dialog (html)
content string Message (html)containerId
nonModal bool If true the dialog will be non-blocking. By default is is blocking
buttons array Array of buttons to be shown in the dialog.
Properties
Name Type Description
text string Button caption.
click: function function activated on click.
htmlEncode bool Html encode the message?
cssClass string Custom css class(es) to used in the dialog
convertCRtoBR bool If true, then carriage returns are converted to html line breaks in the message
height number Height of the dialog window
width number Width of the dialog window
editableMessage bool Make the message editable (and selectable)?
onOpen: function function(event) called when the dialog is shown initially
onClose: function function(event) called when the dialog is closed
destroyOnClose: function If true the dialog will be destroyed after closing
resizeStop: function function(event, ui) binds to resizeStop event of the dialog
Example
omada.dialogHelper.showDialog({ containerId: 'myDialog', content: 'Welcome <b>[user]</b>', title: 'Welcome dialog' });

(static) showKpiDrillDownDataSourceSelectionDialog(options)

// Shows a dialog for KPI data source // options:
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
kpiId string Id of the KPI
title string dialog title

(static) showMessage(options)

Shows a simple modal DHTML message dialog. The call does not block the program flow. To resume the program flow when the dialog closes implement the onClick function in the options.
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
title string Title (text) of the message dialog (window title)
message string Message (html)
nonModal bool If true the dialog will be non-blocking. By default is is blocking
okClick string Parameter-less function activated on click
htmlEncode bool Html encode the message?
convertCRtoBR bool If true, then carriage returns are converted to html line breaks in the message
height number Height of the dialog window
width number Width of the dialog window
editableMessage bool Make the message editable (and selectable)?
Example
omada.dialogHelper.showMessage({ title: 'Warning', message: 'Invalid input in system search mask' });

(static) showPopupMessage(options)

Shows a simple modal message popup without any buttons or title. The popup is closed by clicking outside of it. The size of the popup adjusts to the length of the message.
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
message string Message (html)
htmlEncode bool Html encode the message?
convertCRtoBR bool If true, then carriage returns are converted to html line breaks in the message
Example
omada.dialogHelper.showPopupMessage({ message: 'Hello there my friend' });

(static) showPropertySelectionDialog(options)

Shows a jQuery grid dhtml selection dialog for properties.
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
showSystemNameCol bool Show a column with systemname of properties. Hidden by default.
negIds array Array of property ids. If specified only those objects will not be displayed in the grid.
excludeNonSuitableForRegularDOTBindings bool Exclude certain properties which aren't relevant for data object bindings. E.g. properties prefixed with SSOT_ or SURVFLD_
negSystemNames array Array of system names. If specified only those objects will not be displayed in the grid.
propertyTypes array Array of property types to be displayed
propertyDataTypes array Array of property(value) data types to be displayed
dataObjectTypeIds array Array of data object type ids - only display properties used on the specified types
attributeSuitableProperties bool Only include properties that are suitable to be used as "attribte properties" on a reference property
multiSelection bool If the the the user is allowed to select multiple objects
selectionCompleted function Callback function(selectedIds, selectedRows) to be called when "Ok" has been pressed in the dhtml dialog and at least one item is selected.
Properties
Name Type Description
selectedIds array Array of the ids of the selected rows in the grid
selectedRows object Object with array of items
Properties
Name Type Description
items array Array of items (.items) where each item has a field corresponding to a column name in the grid - in addition each item also has a ._id
Properties
Name Type Description
_id number ID of the selected property
id number ID of the selected property
number number Property number
systemName string System name of the property
name string Name of the selected property
type string Property type
type_property string Contains Value, Set or Reference
datatype string Data type of the selected property
controltype string Control type of the selected property
description string Property description
readOnly bool If true the dialog is shown in read-only mode with the following impact:
    - A 'close' button is shown instead of ok/cancel
    - .multiSelection and .selectionCompleted are ignored
title string The title of the dialog
Example
omada.dialogHelper.showPropertySelectionDialog(
{
  selectionCompleted: function (aSelectedIds, aSelectedRows)
  {
    showMessageDlg(S_COMMON_Text_Warning, 'selected property system name: ' + aSelectedRows.items[0].systemName);
  }
});

(static) showReferenceTreeSelectionDialog(options)

Shows a jQuery dhtml selection dialog for selecting reference property values in a tree formed by a reference property.
Parameters:
Name Type Description
options object Options object.
Properties
Name Type Description
objectTypeId number | string Hierarchy is formed of data objects of this type (id or uid)
viewuid string Optional UId of a Data Object View. If applied, an AccessModifer defined on the Data Object View will be applied to the load options.
parentProperty string Property SystemName of reference property that points to an object's parent
multiSelection bool If true the user is allowed to select multiple objects
selectionCompleted function Callback function(result) to be called when "Ok" has been pressed in the dhtml dialog and at least one item is selected.
Properties
Name Type Description
result object Result object
Properties
Name Type Description
selectedItems array Array of the selected nodes:
Properties
Name Type Description
id string Id of the node
tag string Tag of the node
title string Title of the dialog
folderIcon string Icon to show when showing a folder node
leafIcon string Icon to show when showing a leaf node
loadedObjectsEvaluator function Callback function(data) to be called when data object nodes have been loaded which allows for final manipulation to eg. set a node as "disabled".
Properties
Name Type Description
data object The loaded data which corresponds to the 'result' object of the 'loadCompleted' callback of the omada.dialogHelper.showTreeSelectionDialog API.
Example
omada.dialogHelper.showReferenceTreeSelectionDialog({
  objectTypeId: '3178BF72-A4C5-4AED-9084-6BB99AA42510',
  parentProperty: 'PARENTOU',
  selectionCompleted: function(result) {
    showMessageDlg(S_COMMON_Text_DlgTitle_Message, result.selectedItems[0].id);
  }
});

(static) showResourceAssigmentAttributesDialog(options)

// Displays a grid dialog with the attribute values for a ResourceAssignment data object // options: // .resAssnId: id or uid of a ResourceAssignment data object (reqd)
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
resAssnId string id or uid of a ResourceAssignment data object (reqd)
Example
omada.dialogHelper.showResourceAssigmentAttributesDialog({ resAssnId: '2000' });

(static) showResourceAssignmentsDialog(options)

Contains logic for showing a popup grid with "direct assignments".
The grid allows for expiring assignments - but only if the user has the proper permissions.
Parameters:
Name Type Description
options object Options object.
Properties
Name Type Description
viewId string View uid for resource assignments
readOnly bool If true, the grid is shown in read only mode
multiSelection bool If true, the user can select multiple objects
expressions array Array of expression objects which are used for filtering the Data Objects shown in the grid.
Properties
Name Type Description
path string Reference path from the Data Objects in the view to the Data Object that the expression is for.
property string Property/fixed field to filter on.
operator string Operator [Equals, LessThan, GtThan, LessThanEq, GtThanEq, NotEquals, Like, In, NotIn]
value Filter value for the expression. Can be either a: string, bool or array. An array (of string) is valid if the property is a Set- or Reference-property. It can then specify Data Object Ids or UIds. If the property has data type DateTime the filter value must be a DateTime in xml format.
Example
omada.dialogHelper.showResourceAssignmentsDialog(
{
  viewId: '16f6208f-52ba-4f1a-93b4-ca726fff3828',
    readOnly: false,
    multiSelection: true,
});

(static) showRoPECalculatedAssignmentsDialog(options)

The function shows a grid dialog containing RoPE calculated assignments
Parameters:
Name Type Description
options object Options object.
Properties
Name Type Description
accountTypeIds array Array of account type ids
resourceIds array Array of resource ids
identityIds array Array of identity ids
systemIds array Array of system ids
constraintIds array Array of constraint ids
causeObjectIds array Array of "cause" data object ids. We'll only load assignments caused by the objects with the ids. Data objects of the following types can be cause objects: ResourceAssignment, AssignmentPolicy and (parent) Resource.
prioritizationPolicyIds array Array of prioritization policy data object ids. We'll only load assignments affected by the objects with the ids.
categoryFilter number 0 = account assignments
1 = resource assignments
2 = both(default)
attributeExpressions array Array of expression objects which are applied against attribute values:
Properties
Name Type Description
property string Property(attribute) to filter on
operator string Operator [Equals]
value string Filter value.
resourceExpressions array Array of expression objects which are applied against resources:
Properties
Name Type Description
path string Reference path from the objects in the view to the objects the expression is for
property string Property/fixed field to filter on
operator string Operator [Equals, LessThan, GtThan, LessThanEq, GtThanEq, NotEquals, Like, In, NotIn]
value Filter value. Can be either a: string, boolean, DateTime or array of string. An array of string is valid if the property is a Set- or Reference-property. It can then specify int or guid ids.
loadAttributes bool Must be set to true if the 'attributes' column is displayed. There is a performance penalty using this option.
loadReasons bool Must be set to true if the 'reasons' column is displayed. There is a performance penalty using it.
excludeDisabled bool set to true to exclude disabled cras from data. default is false
fAdjustGridParams bool function which can modify the calculated grid params, for instance the colModel
Example
omada.dialogHelper.showRoPECalculatedAssignmentsDialog({ resourceIds: [appPageVars.formDataId] })

(static) showTreeSelectionDialog(options)

Shows a jQuery dhtml selection dialog for selecting arbitrary objects in a tree structure.
Parameters:
Name Type Description
options object Options object.
Properties
Name Type Description
height number height of the dialog
width number width of the dialog
readOnly bool if true the dialog is shown in read-only mode with the following impact:
    - A 'close' button is shown instead of ok/cancel.
    - .selectionCompleted are ignored.
dialogOpen function Callback function which will be called when the dialog is opened
oButtons: object Buttons object (see jQuery UI docs: http://api.jqueryui.com/dialog/#option-buttons)
Note: these buttons are dialog buttons.
roots array array of tree root node objects:
Properties
Name Type Description
id string node identifier
title string The dialog title whic will be displayed in the tree
selectable bool Is the user allowed to select the object in the dialog?
icon string Icon filename (example: 'images/appicons16/element.png')
tag string Optional info which is delivered to the demandLoad function as .tag
state object optional - Default state of the node
Properties
Name Type Description
opened bool Is the node open
disabled bool Is the node disabled
selected bool Is the node selected
contextmenu array Array of context menu items
multiSelection bool Is the user allowed to select multiple objects?
demandLoad function Callback function(options) called by the dialog when a node is expanded by the user and children needs to be loaded
Properties
Name Type Description
options number Options object for the callback
Properties
Name Type Description
id number Id of the node that has been expanded
ancestors array Array of all ancestors - root is in index 0. Each ancestor object has:
Properties
Name Type Description
id number Node id of the ancestor
tag string Tag of the ancestor
tag string optional info that was specified to loadCompleted by (a previous call to) demandLoad
treeTag string optional object with info that was specified in the options.tag for the tree
treeOptions string the options originally provided to the tree function
loadCompleted function Callback function(result) that must be called by the demand load function when the data is loaded
Properties
Name Type Description
result object The result of the demand load
Properties
Name Type Description
objects array Array of loaded objects:
Properties
Name Type Description
id number Id of the node to be added
title string Value to be displayed for the node in the tree
selectable bool Is the user allowed to select the node in the dialog?
canExpand bool Can the user expand the node in the tree?
icon string Icon filename (example: 'images/appicons16/element.png')
tag string Optional object with node-info which is delivered to the demandLoad function as .tag
state object Optional - Default state of the node
Properties
Name Type Description
opened: bool Is the node open
disabled bool Is the node disabled
selected bool Is the node selected
selectionCompleted function Callback function(result) to be called when "Ok" has been pressed in the dhtml dialog and at least one item is selected. (optional)
Properties
Name Type Description
result object Result object
Properties
Name Type Description
selectedItems array Array of the selected nodes:
Properties
Name Type Description
id number Id of the node
tag string Tag of the node
title string The title of the dialog popup window
tag string optional - info which is delivered to the demandLoad function as .treeTag
requireCreateAccess string load and populate the field hasCreateRight
Example
var roots = [];
roots.push({ id: 1, title: 'My tree root', icon: 'images/appicons16/folder.png' });
omada.dialogHelper.showTreeSelectionDialog({
  title: 'My tree dialog',
  width: 640,
  height: 480,
  roots: roots,
  demandLoad: function (parent) {
    var objects = [];
    objects.push({ id: 2, canExpand: false, title: 'my tree child', icon: 'images/appicons16/folder.png' });
    parent.loadCompleted({ objects: objects });
  },
  selectionCompleted: function (result) {
    showMessageDlg(S_COMMON_Text_DlgTitle_Message, 'selected object: ' + result.selectedItems[0].id);
  }
});

(static) showViewSelectionDialog(options)

// Shows a grid selection dialog for selecting data object views // options:
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
dataObjectTypeIds array array of data object type ids. If supplied, only views filtering on these types are loaded
viewOwnerFlags string Refer to the ViewOwnerFlags_ constant. Default is ViewOwnerFlags_Default
viewOwner string Refer to the ViewOwner_ constant. Default is ViewOwner_Default
requireExactDataObjectTypeMatch bool (Optional) If set to true, only views matching the excact filtering of data object types provided in the dataObjectTypeIds param, are loaded
negIds array Array of view Ids. If specified those views will not be displayed in the grid
multiSelection bool If true, the user is allowed to select multiple data object types.
showNewButton bool If true the selection dialog will include a button to create a new view
selectionCompleted function Callback function(selectedIds, selectedRows) to be called when "Ok" has been pressed in the dhtml dialog and at least one item is selected.
Properties
Name Type Description
selectedIds array Array of the ids of the selected rows in the grid
selectedRows object Object with array of items.
Properties
Name Type Description
items array Each item in the array has a field corresponding to a column name in the grid.
Properties
Name Type Description
id number The ID of the selected view
name number The name of the selected view
uid string The uid of the selected view
readOnly bool If true the dialog is shown in read-only mode with the following impact:
    - A 'close' button is shown instead of OK/Cancel.
    - .multiSelection and .selectionCompleted are ignored.
title string The title on the dialog popup.

Namespace: gridHelper

The functions in omada.gridHelper are for making it easy to work with the ajax grid component. The functions are used in AppListAjax based pages and to show DHTML popups with a grid for displaying/selecting objects.

Methods

(static) clearGridData(options)

Clear grid data & clear the internal storage of selected rows Use this instead of the native jqGrid "clearGridData"
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
sGridId string Grid Id
Example
omada.gridHelper.clearGridData(
{
    sGridId: 'propertiesGrid'
});

(static) clearSelectedRows(options)

Clears selected rows on all pages
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
sGridId string Grid Id
Example
omada.gridHelper.clearSelectedRows(
{
  sGridId: 'propertiesGrid'
});

(static) computeIdealItemsPerPage(options) → {object}

The function computes the ideal number of items which should be shown in a grid page and an array which can be used to change the page size in a grid
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
hasColSearch bool Does the grid allow col search?
additionalOccupiedHeight number Additional pixels which should be substracted from the available space for grid rows
Returns:
- Returns an object containing:
.idealItemsPerPage: Ideal items which should be shown in a grid per page
.itemPerPageArray: Array which can be used as input for "aItemsPerPage" in omada.gridHelper.configureGrid
Type
object

(static) configureGrid(gridParams) → {object}

Configures a (jqGrid) grid control.
This function can be used for displaying any kind of objects (data objects, properties etc.).
Parameters:
Name Type Description
gridParams object Gridparameter object
Properties
Name Type Description
sGridId string Id of the table element that represents the grid
sPagerId string Id of the div element that represents the pager - note that pager is not displayed unless .bAllowPaging is true
sWSDataType string Paging web service 'data type' (corresponds to the values of Omada.OE.WebLib.AjaxGrid.ProducerDataType)
fWSDataTypeArgsRetriever function Function() Must return a oWSDataTypeArgs object. Either fWSDataTypeArgsRetriever or oWSDataTypeArgs must be defined.
fSearchStringRetriever function Function(options) Can be defined if control is needed over the overall search. Must return a search string.
oWSDataTypeArgs object Argument object for the specified data type. Refer to the PagingDataProducerParameters.GetRequiredArgs() C# method to see which properties are required and supported.
aRowData array Array of data to be displayed in the grid (optional). If data is provided in aRowData then the WebService definitions will not be required or used. The array items must consist of objects with an attribute named id as the rowid and an attribute per column having the name as defined in the aColModel. For instance
var data = { id: 1234, name: 'my cell value' }
bRowDataIsVirtual bool Indicate that data should be read directly from array (improves performance on large data sets)
aColModel array Col model array (see jqGrid docs: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options)
aButtons array Array of button objects (shown in the grid footer):
Properties
Name Type Description
caption string Button caption
img string jQuery UI img name. Example: 'ui-icon-plus'. Find allowed icons here: http://jqueryui.com/themeroller/
tooltip string Tooltip for the button
clickEvent function Parameter-less function activated on click
bMultiSelect bool Should the grid allow multiple rows to be selected?
sSearchString string Load paging data using this search string
sCaption string Caption shown above the grid
bCollapsed bool Collapse the grid initially so only the caption is visible?
bAllowColHeaderSearch bool Display a search field in the top of each column?
bAdjustOnWindowResize bool Adjust the size of the grid when the window resizes?
fCalculateGridDimensions function Function(). Called initially and on resize if bAdjustOnWindowResize is true. Must return object with .height and .width specifying the new dimensions of the grid.
bRemoveVerticalGridLines bool Remove the vertical grid lines?
sSortCol string Initial sort column
bSortDesc bool Initial sort descending?
nFirstPage number First page to be displayed. Default: 1
nDispItems number No. of items to display per page. Default: 20
fBeforeSelectRow function Function (rowId, e) function to be called before a row is selected
fBeforeProcessing function Function (data, status, xhr) This event fire before proccesing the data from the server.
fLoadComplete function Function (data)
fSelectAll function Function (aRowids, status) - Called when the "check all" checkbox is toggled
oSubGrid object Subgrid object
Properties
Name Type Description
fSubGridRowExpanded function Function(subgrid_id, row_id) called when a gridrow is expanded. Default: true:
oSubGridOptions object (Optional) A set of options for the subgrid (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:subgrid)
fBeforeRequest function Function(). Called before a WS data retrieval
sHeight string Height of the grid
sWidth string Width of the grid
bAutoWidth bool Autosize width of the grid?
bAllowPaging bool Show the pager?
aItemsPerPage array Array with numbers indicating page size. Default is: [20, 50, 100]
bShowRefresh bool Show refresh button?
fBeforeRefresh function Function () function to be called before data in the grid is refreshed
showDiscreteLoading bool Show loading status in the refresh button instead of the splashscreen in the center of the grid?
bSkipColShrinking bool Skip shrinking the widhts of the columns to fit the grid width?
sRecordText string Custom pager recordtext string. The default is "View {0} - {1} of {2}"
sPgText string Custom pager pgtext string. The default is "Page {0} of {1}"
bShowPagerButtons bool Show prev/next buttons in pager?
bShowPagerInput bool Show text input for page change in pager?
bScrollRows bool Enable row scrolling
fOnCellSelect function Function is called when a a cell is selected with a single left mouse click
fRowAttr function Function is called when the new grid row is inserted. It can be used to set additional style and class attributes of the row dynamically see (http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events)
fOnDblClickRow function Function(rowId, iRow, iCol, e) is called when a row is doubleclicked see(http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events)
sCounterId string Id of the container of grid counter
oLoadingSplash object Object to control behaviour of loading splash
Properties
Name Type Description
bAllowCancel bool Set to true to allow cancelling the ajax request made for loading data. When set to true will a cancel button appear in the "Loading" dialog.
fCancelCallback function Function for custom cancel logic. When not defined, is the default ajax request aborted.
sLoadUi string Behavior of the jqGrid function, the value of this is passed directly to the loadui-parameter of the jqGrid function. If omitted, this will default to 'enable'
Returns:
- grid handle with the following methods: { resize() - function will resize the grid according to gridParams.fCalculateGridDimensions }
Type
object
Example
var gridParams = {
      sWSDataType: 'RoPEIdentities'
      aColModel: colModel,
      aButtons: gridButtons,
      sGridId: 'myGridId',
      sPagerId: "myGridPagerId",
      bAllowPaging: true,
      bMultiSelect: true,
      sHeight: 400,
      bAutoWidth: true,
      aRowData: options.rowData,
      bRowDataIsVirtual: true,
      bAdjustOnWindowResize: true
    }

    omada.gridHelper.configureGrid(gridParams);

(static) getRoPECRAGridCols(options)

Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
cols string array of col names to be displayed in the specified order.
defSortCol string -
defSortDesc string -
loadAttributes bool must be set to true if the "attribute" related hidden cols should be added or if any "attribute" related cols are specified in cols.
loadReasons bool must be set to true if the "reason" related hidden cols should be added or if any "reason" related cols are specified in cols.
loadViolations bool must be set to true if the "violations" related hidden cols should be added or if any "violations" related cols are specified in cols.
complete function Callback: function(settings)
Properties
Name Type Description
settings object Result object for "complete" callback
Properties
Name Type Description
columnDefinitions array Column definitions for the grid

(static) getSelectedRowKeys(options) → {array}

Returns the item ids selected in a grid across pages
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
sGridId string Grid Id
includeSubGridRows boolean If true, selected rows in subgrids will be included
Returns:
Returns an array of selected item ids:
Type
array
Example
var selectedRows = omada.gridHelper.getSelectedRowKeys(
{
  gridId: 'propertiesGrid'
});

(static) getSelectedRows(options) → {array}

Returns all items selected across a grid regardless of search/filtering/sorting
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
sGridId string Grid Id
includeSubGridRows boolean If true, selected rows in subgrids will be included
Returns:
Returns an array of selected items:
.items - Array of selected items with attributes
._id - Row Id
.[column] - For each column in the grid there is an attribute with the grid column value
Type
array
Example
var selectedRows = omada.gridHelper.getSelectedRows(
{
  sGridId: 'propertiesGrid'
});

(static) getViewSettings(options)

Retrieves an object with settings for a view and executes a callback with them. The function is useful for configuring a grid based on a data object view.
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
viewId string Id or uid of a data object view (required)
width number Total width in pixels of the view columns. width is used to calculate the width of the individual columns. If width is null or 0 then the method will calculate a width based on the number of columns in the view.
skipMenuCol bool Skip the column with the context menu icons?
complete function Callback: function(settings)
Properties
Name Type Description
settings object Result object for "complete" callback
Properties
Name Type Description
ViewTitle string Title of the view
ColumnDefinitions array Column definition of the view
DataObjectTypeIds array -
ShowToolButtons bool -
FormId string FormId of the view
FormFieldCount number Number of fields in the form of the view
UserCanCreate bool -
CountRows number Count of rows in the view
viewParentId string Id of the (data object) folder in which new data objects should be placed. If not specified the default parent specified on the data object type will be assumed. Is used to calculate 'UserCanCreate' in the result which is sent to the callback.
Example
omada.gridHelper.getViewSettings({
    viewId: '3AE91C70-438B-4BB6-BA4D-AB1510D72DD7', complete: function (settings)
    {
      var gridParams = {
        sGridId: options.divId + '_grid',
        sPagerId: options.divId + '_pager',
        bAllowPaging: true,
        sWSDataType: options.isWorkItemView ? 'WorkItems' : 'DataObjects',
        oWSDataTypeArgs: dataTypeArgs,
        aColModel: settings.ColumnDefinitions,
        aButtons: options.buttons,
        bMultiSelect: false,
        bAllowColHeaderSearch: options.allowColHeaderSearch,
        bSkipColShrinking: options.skipColShrinking,
        bRemoveVerticalGridLines: false,
        sHeight: options.height,
                bAutoWidth: true,
                fCalculateGridDimensions: function () { return { width: $("#" + options.divId).width() } },
        sCaption: options.caption,
        bCollapsed: options.collapsed
      };

      omada.gridHelper.configureGrid(gridParams);

      if (options.success != null)
        options.success({ viewTitle: settings.ViewTitle });
    }
  });

(static) renderViewGrid(options)

The function renders a grid with Data Objects or Work Items in a <div> element. The rendered grid is resized automatically when the windows is resized.
Instructions:
1) Create an empty <div> element in a Data Object or Work Item Form. The <div> element must have a relative width. Example: <div id="mydiv" style="width:75%; margin-left:auto; margin-right:auto"></div>
2) Call the omada.gridHelper.renderViewGrid() function when the web page is rendered (see example below).
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
viewId string UId of the View to be rendered
isWorkItemView bool Must be true if viewId is a Work Item View (and not a Data Object View)
divId string Id of the empty div element to use as placeholder
height number Desired height in pixels
extraDataTypeArgs object Object with additional data type args which is passed to omada.gridHelper.configureGrid() in the .oWSDataTypeArgs property
buttons array Array of button objects (shown in the grid footer)
Properties
Name Type Description
caption string Button caption
img string jQuery UI img name. Example: 'ui-icon-plus'. Supported icons can be found here: http://jqueryui.com/themeroller/
tooltip string Tooltip for the button
clickEvent function Parameter-less function activated on click
caption string Caption to be shown above the grid. If no caption is specified then nothing is displayed.
uiActions array Array of UI action style buttons to place above grid
Properties
Name Type Description
btnId string Button id
caption string Button caption
disabled string should button be disabled
clickData: string optional object that is available in the clickHandler's e.data
clickHandler string function(e)
collapsed bool Collapse the grid initially so only the caption is visible?
skipResize bool Should the auto resize be skipped?
allowColHeaderSearch bool
skipColShrinking bool Skip shrinking the widhts of the columns to fit the grid width?
bShowPagerInput bool Show text input for page change in pager?
aItemsPerPage bool Array with numbers indicating page size. Default is: [20, 50, 100]
bShowRefresh bool Show refresh button in pager?
bMultiSelect bool Should the grid allow multiple rows to be selected?
success function Callback: function(result)
Properties
Name Type Description
result object Result object for "success" callback
Properties
Name Type Description
viewTitle string Title of the rendered view
Example
jQuery(document).ready(function () {
    omada.gridHelper.renderViewGrid({
        viewId: '3AE91C70-438B-4BB6-BA4D-AB1510D72DD7',
        divId: 'MyDiv',
        height: 200,
        extraDataTypeArgs: { expressions: '&lt;expressions&gt;&lt;expression property="NAME" operator="Equals" value="some name"/&gt;&lt;/expressions&gt;' }
    });
});

(static) setSelectedRow(options)

Toggle selection of grid rows
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
sGridId string Grid Id
rowId string Id of the row to toggle
status bool True if the row should be selected
Example
omada.gridHelper.setSelectedRow(
{
  sGridId: 'propertiesGrid',
  rowId: 'row1',
  status: true
});

(static) showGridDialog(selectionGridParams, showInExportFile) → {object}

Shows a jQuery grid dialog for displaying and/or selecting one or more objects. This function can be used for selecting any kind of objects (data objects, properties etc.).
Parameters:
Name Type Description
selectionGridParams object selectionGridParams object
Properties
Name Type Description
sDialogId string Id of the
that must be created/used for the dialog contents (the function will create the
the first time it is called)
sWebsvc string Web service to receive paging data from
sWSDataType string Paging web service 'data type' (corresponds to the values of Omada.OE.WebLib.AjaxGrid.ProducerDataType)
oWSDataTypeArgs object Arguments for the specified data type.
fWSDataTypeArgsRetriever function Must return a oWSDataTypeArgs object. Either fWSDataTypeArgsRetriever or oWSDataTypeArgs must be defined.
aColModel array Col model array (see jqGrid docs: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options) Additional column parameters:
showInExportFile bool if true, the column will be presented in the export file, even if it is marked as 'hidden'
selectionGridParams.aRowData array Array of row data
selectionGridParams.bRowDataIsVirtual bool Indicate that data should be read directly from array (improves performance on large data sets)
selectionGridParams.bMultiSelection bool Allow multiple objects to be selected
selectionGridParams.sDialogTitle string The displayed title in the dialog
selectionGridParams.sDialogMessage string Message text under the grid
selectionGridParams.oButtons: object Buttons object (see jQuery UI docs: http://api.jqueryui.com/dialog/#option-buttons)
Note: these buttons are dialog buttons. Use aGridButtons to add buttons to the grid itself.
selectionGridParams.bSkipCancelButton bool Skip adding an additional 'cancel' button?
selectionGridParams.bPreventColHeaderSearch bool Prevent displaying a search field in the top of each column?
selectionGridParams.aGridButtons: array Array of button objects (shown in the grid footer):
selectionGridParams.aGridButtons.caption string Button caption
selectionGridParams.aGridbuttons.img string jQuery UI img name. Example: 'ui-icon-plus'. Find allowed icons here: http://jqueryui.com/themeroller/
selectionGridParams.aGridbuttons.tooltip string Button tooltip
selectionGridParams.aGridButtons.clickEvent function Parameter-less function activated on click
selectionGridParams.uiActions array Array of UI action style buttons to place above grid
Properties
Name Type Description
btnId string Button id
caption string Button caption
disabled string should button be disabled
clickData: string optional object that is available in the clickHandler's e.data
clickHandler string function(e)
isSecondary string button is secondary and will be placed in more menu
selectionGridParams.sHeight string Height of the dialog. By default the height is 200px. Note: the dialog width is determined by the grid column widths (see aColModel).
selectionGridParams.bSkipColShrinking: bool Skip shrinking the widhts of the columns to fit the grid width? NOTE: Is always set to true when running on an iPad
selectionGridParams.sRecordText string Custom pager recordtext string. The default is "View {0} - {1} of {2}"
selectionGridParams.sPgText string Custom pager pgtext string. The default is "Page {0} of {1}"
selectionGridParams.aItemsPerPage array Array with numbers indicating page size. Default is: [20, 50, 100]
selectionGridParams.bShowRefresh bool Show refresh button in pager?
gridParams.showDiscreteLoading bool Show loading status in the refresh button instead of the splashscreen in the center of the grid?
selectionGridParams.bShowPagerButtons bool Show prev/next buttons in pager?
selectionGridParams.bShowPagerInput bool Show text input for page change in pager?
selectionGridParams.fBeforeShow string function(args) - fires before the dialog is shown.
selectionGridParams.fBeforeSelectRow string function fires when the user click on a row, but before the row is selected.
gridParams.fBeforeProcessing function Function (data, status, xhr) This event fire before proccesing the data from the server.
selectionGridParams.sSortCol string Initial sort column
selectionGridParams.bSortDesc bool Initial sort descending?
selectionGridParams.bAutoWidth bool Autosize width of the grid?
selectionGridParams.fOnDblClickRow function Function(rowId, iRow, iCol, e) is called when a row is doubleclicked see(http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events)
selectionGridParams.fRowAttr function Function is called when the new grid row is inserted. It can be used to set additional style and class attributes of the row dynamically see (http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events)
selectionGridParams.fOnClose function Function(event, ui) is called when the grid dialog closes.
selectionGridParams.exportToCsv bool Enable export of grid data to CSV file
selectionGridParams.fOnResizeStop function if set it will overwrite standard onresize function
selectionGridParams.oLoadingSplash object Object to control behaviour of loading splash
Properties
Name Type Description
bAllowCancel bool Set to true to allow cancelling the ajax request made for loading data. When set to true will a cancel button appear in the "Loading" dialog.
fCancelCallback function Function for custom cancel logic. When not defined, is the default ajax request aborted.
Returns:
- Returns an object containing:
.gridId: Id of the grid
.pagerId: Id of the pager
Type
object
Example
var selectionGridParams = {
      sDialogId: 'previewGridDialog',
      sDialogTitle: formatStr(S_SURVEY_Caption_PreviewDialog,gridName),
      aColModel: colModel,
      oButtons: dialogButtons,
      sCaption: '',
      sRecordText: '',
      sPgText: '',
      bShowRefresh: false,
      bShowPagerButtons: false,
      bShowPagerInput: false,
      bViewRecords: false,
      bSortDesc: true,
      bMultiSelection: true,
      bSkipCancelButton: true,
      bRowDataIsVirtual: true,
      aRowData: data
    };

    var dlgObj = omada.gridHelper.showGridDialog(selectionGridParams);

(static) validateAnyGridSelection(options)

Validates that at least 1 item is selected in a jqGrid
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
sGridId string Grid Id
Example
omada.gridHelper.validateAnyGridSelection(
{
    sGridId: 'propertiesGrid'
});

(static) validateSingleSelectionGrid(options)

Validates that only 1 item is selected in a jqGrid
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
sGridId string Grid Id
Example
omada.gridHelper.validateAnyGridSelection(
{
    sGridId: 'propertiesGrid'
});

Namespace: uiHelper

The functions in omada.uiHelper are for generating UI controls etc.

Methods

(static) buildPropertyControls(options)

Returns control HTML for a number of properties.
Limitations:
- Value properties w. data type MultiLangText or Hyperlink are not supported.
- Value properties w. log (which are always of data type Text) are not supported.
- Value properties w. data type Boolean: only control type Checkbox, DropDown and Radio are supported.
- Set properties: only control type DropDown and Radio are supported.
- Reference properties: only control type DropDown, LookupSingle and LookupMultiple are supported.
Parameters:
Name Type Description
options object Options object.
Properties
Name Type Description
controls array Array of objects.
Properties
Name Type Description
controlId string Required.
propertyName string Property system name (required).
readOnly bool Make the control read only?
requiresValue bool Require a value for the control?
value string | array For a Value Property, value must be either a: string (Property Data Type: Text, DateTime, Integer), number (Property Data Type: Integer or Decimal) or bool (Property Data Type: Boolean).
For a Set- or Reference Property, value must be an array containing either Set Property Value Ids or Data Object Ids.
tag string Optional "tag" value.
customLookup string Name of a function that takes an options object as parameter. Only used if the property is a Reference Property that renders as a ReferenceListBoxSelection control. If specified the function will be called when the user clicks "add" in the property control. The function will be responsible for displaying a dhtml popup for selecting values. Stating a value for customLookup corresponds to specifying a custom lookup url as "function:myfunction" in the Reference Property setup screen.
The stated function will be called with an options object as parameter that has the following fields:
.currentSelection: array of already selected Data Object Ids.
.lookupViewId: id of the Data Object "lookup" View defined for the Property.
.resultHandler: function(result) that expects to be called with an array of objects with .id and .title of the selected Data Objects.
.showDefaultSelectorPopup: function() that shows the default selection dhtml popup.
callback function Callback: function(result)
Properties
Name Type Description
result object Result object containing the generated UI controls.
Properties
Name Type Description
controls object Dictionary object where keys are controlId strings and values are objects with the following properties.
Properties
Name Type Description
controlOptions object "Options" object from the input options.controls array.
html string Html string for the control.
valueRetriever function function() for retrieving the value(s) of the control. Returns an object.
Properties
Name Type Description
result object
Properties
Name Type Description
values array Array of objects
Properties
Name Type Description
value string | number | bool
displayValue string
hasValue bool Does the control have a value?
isChanged bool Is the control value different than the original one?
validateControls function function() - Validates "requires value" controls. Shows message if a validation error is found. Returns true if validation is ok.
Example
// The example shows a dhtml form with two property controls generated with the omada.uiHelper.buildPropertyControls API.
$(document).ready(function () {
  // We append a container for the dhtml form
  $(document.body).append('<div id="MyDiv"></div>');
  omada.uiHelper.buildPropertyControls(
    {
      // We generate controls for two properties (NAME and RESPONSIBLE)
      controls: [
        { controlId: 'ctrl1', propertyName: 'NAME', requiresValue: true, value: 'some name' },
        { controlId: 'ctrl2', propertyName: 'RESPONSIBLE', value: 3502 }],
      callback: function (result) {
        for (var ctrlId in result.controls) {
          var ctrl = result.controls[ctrlId];
          var reqValueIndicator = ctrl.controlOptions.requiresValue ? ' *' : '';
          $('#MyDiv').append('<hr>' + ctrl.controlOptions.propertyName + reqValueIndicator + ': ' + ctrl.html);
        }

        $("#MyDiv").dialog({
          autoOpen: true, buttons: [
            {
              text: "Validate",
              click: function () { result.validateControls(); }
            },
            {
              text: "Get values",
              click: function ()
              {
                for (var ctrlId in result.controls) {
                  var thevalue = result.controls[ctrlId].valueRetriever();
                  showMessageDlg(S_COMMON_Text_DlgTitle_Message, ctrlId + '\r\nControl has value? ' + thevalue.hasValue + '\r\nHas it been changed? ' + thevalue.isChanged + '\r\nValue: ' + (thevalue.hasValue ? thevalue.values[0].value : '-'));
                }
              }
            }
          ]
        });
      }
    });
});

(static) changeVisibilityValueOptionsShown()

Checks against the selected visibility property and shows the correct list of values, hiding the rest This is used for conditional field toggling configuration

(static) copyTextToClipboard(options)

Copies the supplied text to the clipboard of the user if the browser allows it, else a prompt with the text is shown for manual copying
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
text string Text which should be copied to clipboard
title string If set a dialog will be shown containing the text. This will be the title the dialog. The text can be copied by clicking the "Copy" button in the dialog
showConfirm bool Show confirmation message when text is copied

(static) getPropertyControl(options) → {object}

Returns info about a Property Control that is rendered in a Form - including the value(s) selected in it. The function can only be used in a Data Object Dialog or a Work Item Dialog.
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
property string System name of the Property for which we want to obtain information about the UI control.
Returns:
Returns an object with info about the control:
.property - System name of the Property that the control represents.
.ctrlId - Id of the control.
.requiresValue: Is the property mandatory on the form? .propType - Which type of property are we dealing with? (mainly for debugging purposes) (string).
.dataType - Only relevant if a value property (string).
.values - Array of objects with .value and .displayValue.
The .values array can be empty for Set- and Reference Properties.
For a Value Property the array always contains a single element.
.hasValue - Is .values non-empty? and if so - is the value a 'real' value? (bool) .ctrlType: [TextBox, DropDown, Radio, Checkbox, LookupSingle, LookupMultiple]
Type
object

(static) registerControlChangedEvent(options)

Adds a "change" event handler to one or more Property Controls.
The following Property Control Types are supported:
Set - DropDown, Set - Radio, Set - CheckBox, Reference - DropDown, Reference - LookupSingle, Value - Radio, Value - CheckBox
Parameters:
Name Type Description
options object Options object.
Properties
Name Type Description
controls array The controls for which we want to register "change" event handlers.
Properties
Name Type Description
id string ControlId/FormFieldId (if not specified the API will assume the controls is in an ordinary Data Object Form - not the QuickForm).
property string Property System Name.
fireImmediately bool Should the event handler be called immediately (although no event has occured)?
callback function Callback: function(settings) - Called when the Property Control is changed.
Properties
Name Type Description
property string Property system name.
controlId string Id of the Property Control.
propType string Which type of property are we dealing with? [Value, Set, Reference]
dataType string Only relevant if the Property is of type "Value".
ctrlType string [TextBox, DropDown, Radio, Checkbox, LookupSingle, LookupMultiple]
values array Array of objects.
Properties
Name Type Description
value array Property Value.
displayValue array Display value of the Property Value. The .values array can be empty for Set- and Reference Properties. For a Value Property the array always contains a single element.
hasValue bool Is .values non-empty? and if so - is the value a 'real' value?

(static) setupVisibilityToggleEnablers(disablingControls)

Hooks up to the click-event of all the listed disabling controls and calls the function that disables the toggling controls if appliccable.
Parameters:
Name Type Description
disablingControls object. Property names are control names, values are disabler values

(static) toggleVisibilityTogglingEnabled(disablingControls)

Disables the toggling controls if no disabling controls are in their disabling state.
Parameters:
Name Type Description
disablingControls object. Property names are control names, values are disabler values

Namespace: wsproxy

The functions in omada.wsproxy are for making it easy to work with the OIS UI web services.

Methods

(static) getDataObjectTypeId(options)

Retrieves the Data Object Type Id of a Data Object.
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
id number Id of the Data Object (Required).
success function function (result)
Properties
Name Type Description
result object Result object
Properties
Name Type Description
id number Id of the Data Object
typeId number Id of the Data Object's Data Object Type

(static) getDataObjects(options) → {object}

Retrieves a number of Data Objects. If a Data Object is not accessible or doesn't exist it is omitted from the result. Only the following Value Property Data Types are supported: Boolean, Integer, Decimal and Text.
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
ids array Array of ids of the Data Objects to be loaded. Can be either integer Ids or guid UIds. Tip: instead of specifying one or more ids it is (as an alternative) possible to just specify one or more expressions.
path string Specifies an optional reference path that will be applied to the specified ids. If omitted the Data Objects corresponding to the specified ids are returned.
expressions array Array of "expression" objects
Properties
Name Type Description
path string Reference path from the Data Objects being retrieved to the Data Objects the expression is for.
property string System name of Property or Fixed Field to filter on
operator string Operator [Equals, LessThan, GtThan, LessThanEq, GtThanEq, NotEquals, Like, In, NotIn]
value string | bool | array Filter value. Can be either a: string, boolean or array of string. An array of string is valid if the property is a Set- or Reference Property. It can then specify Ids or UIds.
properties array Array of system names of Properties to be loaded. If omitted (null) all Properties are loaded.
sorting array Array of FixField names or system names of Properties to be sorted on. If omitted (null) sorting is not performed. If a name is postfixed with " desc" then the sorting is descending - else is it ascending. Currently it is only possible to specify one sorting property.
viewuid string Optional UId of a Data Object View. If applied, an AccessModifer defined on the Data Object View will be applied to the load options. Access to the Data Object View is respected. If omitted the DOSM security model applies.
keepPleaseWaitSplashOpen bool (optional) default is false. Keeps waiting splash open after success call
skipNonExisting bool (optional) default is false. If set to true and uids provided, not found objects will be skipped. In other case error is thrown.
success function Callback: function(objects)
Properties
Name Type Description
objects array An array of the objects.
Properties
Name Type Description
$Id number Id of the Data Object.
$DisplayName string Display name of the Data Object.
$UId string UId of the Data Object.
$TypeId number Id of the Data Object's Data Object Type.
$CreatedBy number Id of User who created the Data Object.
[property_system_name string | bool | number | array For Set- and Reference Properties the value is an array of the value Ids.
[property_system_name]_Names string Present for Set- and Reference Properties: holds an array of the value names.
success2 function Callback: function(result)
Properties
Name Type Description
result object Result object.
Properties
Name Type Description
objects array An array of Data Objects. Each Data Object has fields as described above.
inputOptions object The options object provided as input for the function.
async bool default true
error function Callback: function(jqXHR, textStatus, errorThrown)
Returns:
Returns an object:
.getObjectById: function (id, objects)
Type
object
Example
// Load and display all "Folder" Data Objects
omada.wsproxy.getDataObjects({
  expressions: [{ property: 'Type', operator: 'Equals', value: 'FOLDER' }],
  properties: [], // we're only interested in the DisplayName so we skip loading any properties
  success2: function (result) {
    var dispNames = [];
    for (var i = 0; i < result.objects.length; i++)
      dispNames.push(result.objects[i].$DisplayName);
    showMessageDlg(S_COMMON_Text_DlgTitle_Message, result.objects.length + ' "Folder" Data Objects loaded: ' + dispNames.join(','));
  }
});

(static) getProcessTemplates(options)

Retrieves a number of Process template Objects. If a Process template Object is not accessible or doesn't exist it is omitted from the result.
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
ids array Array of ids of the Process template to be loaded. Can be either integer Ids or guid UIds. Tip: instead of specifying one or more ids it is (as an alternative) possible to just specify one or more expressions.
expressions array Array of "expression" objects
Properties
Name Type Description
path string Reference path from the Data Objects being retrieved to the Data Objects the expression is for.
property string System name of Property or Fixed Field to filter on
operator string Operator [Equals, LessThan, GtThan, LessThanEq, GtThanEq, NotEquals, Like, In, NotIn]
value string | bool | array Filter value. Can be either a: string, boolean or array of string. An array of string is valid if the property is a Set- or Reference Property. It can then specify Ids or UIds.
success function Callback: function(objects)
Properties
Name Type Description
objects array An array of the objects.
Properties
Name Type Description
$Id number Id of the Process template.
$UId string UId of the Process template.
$DisplayName string Display name of the Process template.
$CreatedBy number Id of User who created the Process template.
$OwnerId number Id of User set as Owner of the Process template.
$CreatedTime number Time of Process template creation.
$TargetId number Id of Target
$TargetTypeId number Id of target DataObject type.
$TemplateId number Template Id of the Process
$State number -
Example
// Load and display all Process template created by System administrator
omada.wsproxy.getProcessTemplates({
  expressions: [{ property: 'CREATEDBY', operator: 'Equals', value: 3502 }],
  success: function (result) {
    var dispNames = [];
    for (var i = 0; i < result.length; i++)
      dispNames.push(result[i].$DisplayName);
    showMessageDlg(S_COMMON_Text_DlgTitle_Message, result.length + ' "Process Template" objects loaded: ' + dispNames.join(','));
  }
});

(static) importDataObjects(options)

Imports (creates, updates, deletes) a number of Data Objects. The function has two modes:
- "xml" mode where the input data is a string with DataObjectExchangeML xml data
- "objects" mode where the input data is an array of Data Object operations.
Depending on the mode the function executes two different web services.
Parameters:
Name Type Description
options object Options object.
Properties
Name Type Description
xml string String with DataObjectExchangeML xml data (using this puts the function in "xml" mode).
objects array Array of Data Object operations (using this puts the function in "objects" mode).
Properties
Name Type Description
id string Data Object UId - required unless the operation is "create".
type string System name of a Data Object Type - whether required or not depends on the operation.
operation string ["create", "update", "updateIfExists", "updateOrCreate", "delete", "deleteIfExists", "none"]
[property_system_name]_v array Array of values for a Property where each value is an object.
[property_system_name]_v.value number | string Set- or Reference Property: value must be an Id of a Set Property Value or a Data Object.
Value property w. datatype 'DateTime' or 'TimeSpan': value must be an xml encoded string value.
[property_system_name]_v.isKeyReference bool Bool indicating if "value" is a string that references a key-value (only relevant if the property is a Reference Property).
settings object Object (only used in "xml" mode).
Properties
Name Type Description
SkipImport bool Set to true to only deserialize the xml data - don't perform the actual import.
AllowedErrors number Threshold for no. of allowed errors before the import terminates.
success function Callback: function(result)
Properties
Name Type Description
result object Result object.
Properties
Name Type Description
CreatedObjectIds array Array of Data Object Ids that has been created in the import.
UpdatedObjectIds array Array of Data Object Ids that has been updated in the import.
DeletedObjectIds array Array of Data Object Ids that has been deleted in the import.
UnchangedObjectIds array Array of Data Object Ids that are unchanged.
Errors array Array of error messages
error function Callback: function (jqXHR, textStatus, errorThrown) If not specified a default error handler is used that alerts the error message.
Properties
Name Type Description
jqXHR
textStatus
errorThrown
async bool Default true
Example
omada.wsproxy.importDataObjects({
  objects: [{ type: 'FOLDER', operation: 'create', NAME_v: [{ value: 'My new folder' }] }],
  success: function (result) {
    showMessageDlg(S_COMMON_Text_Warning, 'Import completed - created ' + result.CreatedObjectIds.length + ' Data Objects');
  },
  error: function (jqXHR, textStatus, errorThrown) {
    omada.ajaxHelper.alertAjaxError(this, jqXHR, textStatus);
  }
});

(static) resolvePropertyValues(options)

Resolves a textual value for a Property into a number of property values. The function is used when typing in and resolving a value for a Set- or Reference Property.
Parameters:
Name Type Description
options object Options object.
Properties
Name Type Description
property string System name of the Property we are resolving values for. Must be either a Reference- or a Set Property.
searchStr string Search string we want to resolve to a number of values based on.
maxResults number Maximum number of results to return.
pageContextResolver function function which will be called to create a page context string. The function must return a string
viewId number Integer ID of the view to use when auto completing / drop down options.
success function function (result)
Properties
Name Type Description
result object The result object is a dictionary where the fields are value Ids and the values are value names.
Properties
Name Type Description
[id number Id of the property value. Is either a Data Object Id or a Set Property Value Id.
[name string Name of the property value. Is either a Data Object Display Name or a Set Property Value Name.
async bool Default true.
Example
omada.wsproxy.resolvePropertyValues({
  property: 'IDENTITYREF',
  searchStr: 'some value',
  maxResults: 10,
  success: function (result) {
    for (var id in result)
      showMessageDlg(S_COMMON_Text_DlgTitle_Message, 'Id:' + id + ', Name:' + result[id]);
    }
});

(static) startSignalRHub(options, connection)

Start the SignalR hub and invoke functions on specific hubs
Parameters:
Name Type Description
options object Options object
Properties
Name Type Description
success function Callback: function() This function is called when the SignalR hub is ready. In here you can invoke functions in all hubs
reconnecting function Callback: function() This function is called when SignalR is aware of a disconnection and is going into reconnecting mode
disconnected function Callback: function() This function is called when SignalR is aware of a disconnection and is trying to reconnect
fail function Callback: function(exception) This function is called when an exception is thrown in a hub.
enableLogging bool Enable log output in the browser console (default is true)
connection optional connection object, if you don't want to use the connection generated by the proxy
Example
// Delete data objects
  omada.wsProxy.startSignalRHub({
    success: function () {
      omada.dataObjLst.dataObjectsHub.server.deleteDataObjects(idsToDelete).done(function (result) {
        progBar.hide();
        omada.appList.reloadGrid();
      })
    },
    fail: function (exception) {
      //Do something
    }
  });