RMP_List
new RMP_List()
RunMyProcess List
Example
var list = new RMP_List();
Methods
addItem(value, label)
Adds an element to a "RunMyProcess List".
Parameters:
| Name | Type | Description |
|---|---|---|
| value | String | |
| label | String |
Example
list.addItem("One","1");
fromArray(object)
this function sets a "RunMyProcess List" from a json array.
Parameters:
| Name | Type | Description |
|---|---|---|
| object | object |
Example
list.fromArray([{'label':'toto', 'value':2},{'label':'titi',value:3}]);
fromJSONArray(json)
this function sets a "RunMyProcess List" from the string format of a json array.
Parameters:
| Name | Type | Description |
|---|---|---|
| json | object |
Example
var jsonString = "[{'label':'toto', 'value':2},{'label':'titi',value:3}]";
list.fromJSONArray(jsonString);
fromJSONObject(json)
this function sets a "RunMyProcess List" from a string format of a json object.
Parameters:
| Name | Type | Description |
|---|---|---|
| json | object |
Example
var jsonString = '{ "list": [{"label":"aa", "value":"bb"}], "valueField":"value", "labelField":"label", "listField":"list" };';
list.fromJSONObject(jsonString);
fromObject(object)
this function sets a "RunMyProcess List" from an object configuration
Parameters:
| Name | Type | Description |
|---|---|---|
| object | object |
Example
var object = { "list": [{"label":"aa", "value":"bb"}], "valueField":"value", "labelField":"label", "listField":"list" };
list.fromObject(object);
getItemAt(index) → {Object}
this function returns a value/label structure of a "RunMyProcess List" at a given index (starting at 0).
Parameters:
| Name | Type | Description |
|---|---|---|
| index | String |
Returns: Object
Example
var myitem = list.getItemAt("0");
alert(myitem.label);
alert(myitem.value);
getItemFromLabel(label) → {Object}
This function returns item from list according to a given label.
Parameters:
| Name | Type | Description |
|---|---|---|
| label | String |
Returns: Object
getItemFromValue(value) → {Object}
this function returns item from list according to a given value.
Parameters:
| Name | Type | Description |
|---|---|---|
| value | String |
Returns: Object
Example
{"label":"xxx","value":"yyy"}
getItemIndexFromLabel(label) → {int}
This function returns index of an item from list according to a given label.
Parameters:
| Name | Type | Description |
|---|---|---|
| label | String |
Returns: int
getItemIndexFromValue(value) → {Object}
this function returns item from list according to a given index (First item of a list has index 0).
Parameters:
| Name | Type | Description |
|---|---|---|
| value | String |
Returns: Object
getItemLabel(item) → {String}
this function returns the label of a "RunMyProcess List" item
Parameters:
| Name | Type | Description |
|---|---|---|
| item | Object |
Returns: String
getItemLabelAt(index) → {String}
this function returns label of a "RunMyProcess List" at a given index (starting at 0).
Parameters:
| Name | Type | Description |
|---|---|---|
| index | String |
Returns: String
Example
var item = list.getItemLabelAt("0");
getItemLabelFromValue(value) → {String}
this function returns label from list according to a given value
Parameters:
| Name | Type | Description |
|---|---|---|
| value | String |
Returns: String
getItemValue(item) → {String}
this function returns the value of a "RunMyProcess List" item
Parameters:
| Name | Type | Description |
|---|---|---|
| item | Object |
Returns: String
getItemValueAt(index) → {String}
this function returns value of a "RunMyProcess List" at a given index (starting at 0).
Parameters:
| Name | Type | Description |
|---|---|---|
| index | String |
Returns: String
Example
var item = list.getItemValueAt("0");
getItemValueFromLabel(label) → {String}
This function returns value from list according to a given label
Parameters:
| Name | Type | Description |
|---|---|---|
| label | String |
Returns: String
getLabelField() → {String}
this function returns label field name of a "RunMyProcess List".
Returns: String
Example
var field = list.getLabelField();
getListField() → {String}
returns the list field name of a "RunMyProcess List".
Returns: String
getValueField() → {String}
this function returns value field name of a "RunMyProcess List".
Returns: String
Example
var field = list.getValueField();
removeItemAt(index)
this function removes an element of a "RunMyProcess List" at a given index (starting at 0).
Parameters:
| Name | Type | Description |
|---|---|---|
| index | String |
Example
list.removeItemAt("0");
removeItemFromLabel(label)
This function remove a given item from list according to a given label.
Parameters:
| Name | Type | Description |
|---|---|---|
| label | String |
removeItemFromValue(value)
This function remove a given item from list according to a given value.
Parameters:
| Name | Type | Description |
|---|---|---|
| value | String |
setItemLabel(item, label)
this function replaces the label of a "RunMyProcess List" item.
Parameters:
| Name | Type | Description |
|---|---|---|
| item | Object | |
| label | String |
Example
list.setItemLabelAt(item, "Ten");
setItemLabelAt(index, label)
this function replaces the label of a "RunMyProcess List" at a given index (starting at 0).
Parameters:
| Name | Type | Description |
|---|---|---|
| index | String | |
| label | String |
Example
list.setItemLabelAt("0", "Ten");
setItemValue(item, value)
this function replaces the value of a "RunMyProcess List" item.
Parameters:
| Name | Type | Description |
|---|---|---|
| item | Object | |
| value | String |
Example
list.setItemLabelAt(item, "New value");
setItemValueAt(index, value)
this function replaces value of a "RunMyProcess List" at a given index (starting at 0).
Parameters:
| Name | Type | Description |
|---|---|---|
| index | String | |
| value | String |
Example
list.setItemValueAt("0", "10");
setLabelField(labelField)
this function sets label field name for a "RunMyProcess List" when label field name is not called "label".
Parameters:
| Name | Type | Description |
|---|---|---|
| labelField | String |
Example
list.setLabelField("description");
setListField(listField)
this function sets list field name for a "RunMyProcess List" when list field name is not called "list".
Parameters:
| Name | Type | Description |
|---|---|---|
| listField | String |
Example
list.setValueField("name");
setValueField(valueField)
this function sets value field name for a "RunMyProcess List" when value field name is not called "value".
Parameters:
| Name | Type | Description |
|---|---|---|
| valueField | String |
Example
list.setValueField("name");
size() → {int}
returns the size of the "RunMyProcess List".
Returns: int
toString() → {String}
Returns the string representation of a "RunMyProcess List"
Returns: String