Module

RMP_Array


new RMP_Array(conf)

This constructor allows you to create an array widget that can be inserted dynamically in your web interface.

Parameters:
Name Type Description
conf Object JSON structure which contains the configuration of the array
Example
var switchConf = {
    id: 'id_check',
    label: 'Checker',
    "js-type":"RMP_CheckBox",
    variables: [{ id: 'variable', name: 'foo', value: 'no' }],
    valueoff: 'no',
    valueon: 'yes',
};
var inputConf = {
    "id":"id_number1",
    "label":"My number label",
    "variable":[{"id":"variable","name":"nbr","value":15}],
    "js-type":"RMP_TextInput",
    "sub-type":'number'
};
var arrConf = {
    "id":"id_array",
    "js-type":"RMP_Array",
    "addRows": true,
    "deleteRows": true,
    "variable":[{id:"variable","name":"array"}],
    "column":[
        {"header":"Header 1","widget":inputConf},
        {"header":"Header 2","widget":switchConf}
    ]
};
var array = new RMP_Array(arrConf);
id_of_a_widget.insertAfter(array);

Methods

# inner getColumnsCount() → {number}

Returns the number of columns of an array.
number

# inner getHeader(columnIndex) → {string}

Returns the header value of a given column of the array.
Parameters:
Name Type Description
columnIndex number Index of the column (starts at 0)
header name of the column
string

# inner getRowsCount() → {number}

Returns the number of rows of an array.
number

# inner getType() → {string}

Returns the type of the widget (RMP_Array).
string

# inner insertRow(rowIndex)

Inserts a row after the given index.
Parameters:
Name Type Description
rowIndex number Index of the row after which the new row is to be inserted (starts at 0)

# inner isAddRows() → {boolean}

Returns true if the array allows to add new rows, otherwise false.
boolean

# inner isColumnVisible(columnIndex) → {boolean}

Returns true if the given column is visible, otherwise false. If the column does not exist, false is returned.
Parameters:
Name Type Description
columnIndex number Index of the column (starts at '0')
boolean

# inner isDeleteRows() → {boolean}

Returns true if the array allows to delete rows, otherwise false.
boolean

# inner isModifyRows() → {boolean}

Returns true if the "Can modify" field is enabled, otherwise false.
boolean

# inner removeRow(rowIndex)

Removes a given row.
Parameters:
Name Type Description
rowIndex number Index of the row to be removed (starts at 0)

# inner setAddRows(bool)

Sets the "Add rows" field value of an array.
Parameters:
Name Type Description
bool boolean State of the "Add rows" property

# inner setArrayColumnFooter(callBk, customColIdx, optionsopt)

Customizes a column footer of an array.
Parameters:
Name Type Attributes Description
callBk function Function to be executed and return column footer value
customColIdx number Index of the column
options Object <optional>
executeEvenEmpty boolean Execute the callback function even when a listened to variable is empty
errorMessage string Message to be displayed when the callback function generates an error
listenedVariables Array.<Object> Array of variables to listen to, for example: [{ name: 'array.name', index: 0 }, {name : 'text'}].
listenedVariables[].name string Name of a variable
listenedVariables[].index number <optional>
Index of a variable in an array

# inner setArrayCustomColumnScript(callBk, customColIdx, optionsopt)

Handles custom columns in an array.
Parameters:
Name Type Attributes Description
callBk function Function to be executed and return custom column value
customColIdx number Index of the column
options Object <optional>
executeEvenEmpty boolean Execute callback function even when a listened to variable is empty
errorMessage string Message to be displayed when the callback function generates an error
listenedVariables Array.<Object> Array of variables to listen to, for example: [{ name: 'array.name', index: 0 }, {name : 'text'}].
listenedVariables[].name string Name of a variable
listenedVariables[].index number <optional>
Index of a variable in an array
if customColIdx < 1 or if the column at customColIdx is not a type script column

# inner setArrayFooter(callBk, optionsopt)

Customizes the array footer.
Parameters:
Name Type Attributes Description
callBk function Function to be executed and return footer value
options Object <optional>
executeEvenEmpty boolean Execute the callback function even when a listened to variable is empty
errorMessage string Message to be displayed when the callback function generates an error
listenedVariables Array.<Object> Array of variables to listen to, for example: [{ name: 'array.name', index: 0 }, {name : 'text'}].
listenedVariables[].name string Name of a variable
listenedVariables[].index number <optional>
Index of a variable in an array

# inner setColumnActive(columnIndex, active)

Sets a column as active or not.
Parameters:
Name Type Description
columnIndex number Index of the column (starts at 0)
active boolean Active state of the column

# inner setColumnVisible(columnIndex, visible)

Sets a column as visible or not.
Parameters:
Name Type Description
columnIndex number Index of the column (starts at 0)
visible boolean Visible state of the column

# inner setDeleteRows(bool)

Sets the "Delete rows" field value of an array.
Parameters:
Name Type Description
bool boolean State of the "Delete rows" property

# inner setHeader(columnIndex, text)

Sets the header value of a given column of the array.
Parameters:
Name Type Description
columnIndex number Index of the column (starts at 0)
text string New header value

# inner setModifyRows(bool)

Enables or disables the "Add row" and "Delete row" buttons on an array.
Parameters:
Name Type Description
bool boolean Enable/disable the modification of rows

# inner setOnAddRowScript(callBk)

Sets the function to execute after a row has been added.
Parameters:
Name Type Description
callBk function Callback to be exectued

# inner setOnDeleteRowScript(callBk)

Sets the function to execute after a row has been deleted.
Parameters:
Name Type Description
callBk function Callback to be exectued