VariableSetService
VariableSetService allows to manage dynamic tables and variables in these tables. It has the following functions:
get– gets dynamic table component.
Function parameters:
Name | Typee | Default value | Description |
---|---|---|---|
variableSetIdParam | String/Number | null | Dynamic table id /Dynamic table number on the form according to the process map (the first table has the number 0) |
Function result:
Typee | Description |
---|---|
Suncode.form.view.gadget.variableset.VariableSet | Dynamic table component or undefined if it was not found |
Function parameters:
getAll- returns all components of dynamic tables.
Name | Typee | Default value | Description |
---|---|---|---|
getEditable | Boolean | false | Information whether to return only editable dynamic tables |
Function result:
Typee | Description |
---|---|
Suncode.form.view.gadget.variableset.VariableSet[] | An array of dynamic table components or an empty array if no table was found |
hide - hides dynamic tables
Function parameters:
Name | Typee | Default value | Description |
---|---|---|---|
variables | String/Number/String[],Number[] | null | ID / table of dynamic table identifiers or number (index) / array of dynamic table numbers. The number specifies the index of the dynamic table on the form, for the number 0 it is the first table of the task, etc. By giving the table, you can mix Typees, i.e. you can specify an array: [ 'table_id_1', 3 ], which will hide the table with id: 'table_id_1' and a table, which is the fourth in order on the form. |
Function result: null
show - shows dynamic tables
Function parameters:
Name | Typee | Default value | Description |
---|---|---|---|
variables | String/Number/String[],Number[] | null | ID / table of dynamic table identifiers or number (index) / array of dynamic table numbers. The number specifies the index of the dynamic table on the form, for the number 0 it is the first table of the task, etc. By giving the table, you can mix Typees, i.e. you can specify an array: [ 'table_id_1', 3 ], which will show the table with id: 'table_id_1' and a table, which is the fourth in order on the form. |
Function result: null
addRow- adds an empty record to the dynamic table. It is possible to start editing the first editable cell of the newly added record.
Function parameters:
Name | Typee | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
startEditing | Boolean | false | Informs whether to start to edit the first editable cell of the newly added record |
records | Object/Object[] | {} | Value in new row with character { id_column1 : "value_1", id_column2 : "value_2" }. |
silentMode | Boolean | true | Work in "silent mode", e.g. do not load table mappings. |
Function result: null
insertRow - inserts an empty record into the dynamic table at the given position. It is possible to start editing the first editable cell of the newly added record.
Function parameters:
Name | Typee | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
index | Number | null | The number of the row from which the new rows will be inserted. The number must be greater than or equal to 0. |
startEditing | Boolean | false | Informs whether to start to edit the first editable cell of the newly inserted record |
records | Object/Object[] | {} | Value in the inserted row with character { id_column1 : "value_1", id_column2 : "value_2" }. |
Function result: null
getSelected- gets the currently selected record in the dynamic table, returns null when no record is currently selected.
Function parameters:
Name | Typee | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function result:
Typee | Description |
---|---|
Ext.data.Model | Currently selected record |
deleteSelected- deletes all selected records in the dynamic table.
Function parameters:
Name | Typee | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function result: null
Function parameters:
copySelected - copies all selected records in the dynamic table.
Name | Typee | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function result: null
getRowIndex- returns the row number for the record.
Function parameters:
Name | Typee | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
record | Ext.data.Model | null | Dynamic table record object |
Function result:
Typee | Description |
---|---|
Integer | Row number |
getColumnIndex -returns the column number for the given form variable.
Function parameters:
Name | Typee | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
variableId | String | null | The id of the form variable (process variable identifier) in the dynamic table |
Function result:
Type | Description |
---|---|
Integer | Column number |
getValue- returns the value of a form variable in a specific cell in the dynamic table or a string of values from all cells in a given column (from 3.1.8).
Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
rowIndex | Integer | null | The row number of the record (the first row has the number 0). If you specify null, a string of values is returned from all cells in a given column. The next values are separated by a semicolon (from 3.1.8) |
variableId | String | null | The id of the form variable (process variable identifier) in the dynamic table |
Function result:
Type | Description |
---|---|
Object | Variable value in the cell |
setValue -sets the value of a form variable in a specific cell in a dynamic table or a string of values in all cells in a given column (if the value string is longer than the number of records in the dynamic table, new records are added with empty values for other cells if the value string is shorter , than the number of records in the dynamic table, in the other records in a given column an empty value is set) (from 3.1.8).
Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
rowIndex | Integer | null | The row number of the record (the first row has the number 0). If you specify null, a string of values is set in all cells in a given column. The next values should be separated by a semicolon (from 3.1.8) |
variableId | String | null | The identifier of the form variable (process variable identifier) in the dynamic table |
value | Object | null | The value of the form variable |
Function result:null
Function parameters:
save - writes dynamic table records to the task context.
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function parameters:
- Function result:null
markErrorCell - selects the cell in the dynamic table as invalid (red background).
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
rowIndex | Integer | null | The row number of the record (the first row has the number 0) |
variableId | String | null | The id of the form variable (process variable identifier) in the dynamic table |
Function result:null
Function parameters:
unmarkErrorCell- unmarks the cell in the dynamic table as invalid (removes the red background).
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
rowIndex | Integer | null | The row number of the record (the first row has the number 0) |
variableId | String | null | The id of the form variable (process variable identifier) in the dynamic table |
Function result:null
getVariableSetData - returns all form variables in all records in the dynamic table in the form of JSON.
Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function result:
Type | Description |
---|---|
String | Table contents in the form of JSON |
getRowsCount - returns the number of rows in the dynamic table.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function result:
Type | Description |
---|---|
Integer | The number of rows in the dynamic table |
getColumnSum - returns the sum of values from a given column.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
variableId | String | null | Process variable that identifies the column in the dynamic table |
grouped | Boolean | false | It informs whether to return the result in the form of an object containing the sum from individual groups (only valid if the dynamic table has active the grouping option) |
Function result:
Type | Description |
---|---|
Integer/String | The sum of values from a given column (Type String occurs when the sum has been made on a column that contains text values - the result is a string of characters) |
setTitle- sets the title.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
title | String | null | Title (HTML tags are possible) |
Function result:null
removeBottomToolbarButtons - removes all buttons from the bottom bar and hides it. Adding records using the keyboard is only possible if the add, insert or copy button is available, visible and unblocked. Deleting records using the keyboard is only possible if the delete button is available, visible and unblocked.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function result:null
removeBottomToolbarButton - removes a specific button from the bottom bar and hides it when the button was last available on the bar. Adding records using the keyboard is only possible if the add, insert or copy button is available, visible and unblocked. Deleting records using the keyboard is only possible if the delete button is available, visible and unblocked.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
itemId | String | null | The id of the button on the bar. Expected values are: |
Function result:null
disableBottomToolbarButtons - blocks all buttons from the bottom bar. Adding records using the keyboard is only possible if the add, insert or copy button is available, visible and unblocked. Deleting records using the keyboard is only possible if the delete button is available, visible and unblocked.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function result:null
disableBottomToolbarButton - blocks a specific button from the bottom bar. Adding records using the keyboard is only possible if the add, insert or copy button is available, visible and unblocked. Deleting records using the keyboard is only possible if the delete button is available, visible and unblocked.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
itemId | String | null | The id of the button on the bar. Expected values are: |
Function result:null
enableBottomToolbarButtons - activates all buttons from the bottom bar. Adding records using the keyboard is only possible if the add, insert or copy button is available, visible and unblocked. Deleting records using the keyboard is only possible if the delete button is available, visible and unblocked.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function result:null
enableBottomToolbarButton - activates the specified button from the bottom bar. Adding records using the keyboard is only possible if the add, insert or copy button is available, visible and unblocked. Deleting records using the keyboard is only possible if the delete button is available, visible and unblocked.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
itemId | String | null | The id of the button on the bar. Expected values are: |
Function result:null
addBottomToolbarButton - adds a button to the bottom bar.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
button | Object/Ext.button.Button | null | Button configuration object (provided for creating Ext.button.Button) |
Function result:null
insertBottomToolbarButton - adds a button to the bottom bar at a specific position.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
button | Object/Ext.button.Button | null | Button configuration object (provided for creating Ext.button.Button) |
index | Integer | null | The position to which the button is added |
Function result:null
setBottomToolbarButtonDescription - sets button description displayed on mouse hover.
- Function parameters:
Nazwa | Typ | Wartość domyślna | Opis |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
buttonId | String | null | The id of the button on the bar. Expected values are: - any id, being the button id DT_BUTTON given in the map |
description | String | null | Button description |
Function result: null
getRecordsByCriteria - searches records in the dynamic table based on given criteria (values in columns, accuracy in value and Typeu).
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
criteria | Object[] | [] | An array of criteria objects. The criterion must contain the following properties: |
Function result:
Type | Description |
Ext.data.Model[] | Records found |
deleteRecordsByCriteria - removes records from the dynamic table based on given criteria with accuracy to Typeu (values in columns, accuracy in value and Typeu).
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
criteria | Object[] | [] | An array of criteria objects. The criterion must contain the following properties: |
Function result:
Type | Description |
---|---|
Integer | Number of deleted records |
deleteRecords (from 3.1.8) - deletes specific records from the dynamic table.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
records | Ext.data.Model[] | null | Record table to delete |
Function result:null
clear - deletes all records from the dynamic table.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
silent | Boolean | false | Informs that during delation bulkremove actions and clear for storage have to be called. |
Function result:null
showColumn - shows the column in the dynamic table.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
variableId | String | null | Process variable that identifies the column in the dynamic table |
Function result:null
hideColumn - hides column in the dynamic table.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
variableId | String | null | Process variable that identifies the column in the dynamic table |
Function result:null
getColumnName- gets the name of the column in the dynamic table including the translation (visible in the header).
Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
variableId | String | null | Process variable that identifies the column in the dynamic table |
Function result:
Type | Description |
---|---|
String | Name of the column in the dynamic table or null if the column with the given id does not exist in the table |
setColumnName- sets the column name in the dynamic table (visible in the header), saves information about the Description and maturity of variable.
Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
variableId | String | null | Process variable that identifies the column in the dynamic table |
name | String | null | Column name |
Function result:null
setColumnDescription - sets column description on mouse hover.
- Parametry funkcji:
Nazwa | Typ | Wartość domyślna | Opis |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
variableId | String | null | Process variable that identifies the column in the dynamic table |
description | String | null | Column description |
Function result:null
addTool- adds a tool button to the dynamic table header.
Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
tool | Object/Ext.panel.Tool | null | Tool configuration object (provided for creating Ext.panel.Tool) |
Function result:null
getTitle- returns the title of the dynamic table without HTML tags.
Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function result:
Type | Description |
---|---|
String | The title of the dynamic table without HTML tags |
getInfo- returns information about the dynamic table.
Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function result:
Type | Description |
---|---|
Object | An object containing information about a dynamic table. The object has the following properties: - id (Type String) Dynamic table id - originalName(Type String) The original title of the dynamic table (propertyDT_TABLE_NAMEfrom configuration) - title (Type String) The title of the dynamic table without HTML tags - columns (Type Array) Information table about individual columns. Each element is Typeu Object and contains the following properties: - id (Type String) The id of the process variable - name (Type String) Name of the dynamic table column (Name of the process variable) including the translation (Name visible in the header) - editable (Type Boolean) Informs whether the column is editable - hidden (Type Boolean) Informs whether the column is hidden |
addRenderer (from 3.1.6) - allows to add any function that renders the value of a cell in the dynamic table. You can register any number of renderers that will be called according to the order in which they were added.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
renderer | Function | null | Function that renders the value of column data. It accepts the following parameters: - value: cell value (not formatted) - data: object of the entire record (row) { "variable_id": "value", " variable_id2": "value2" } - column: ID of the currently rendered column (variable id) - metaData: object containing information about row { row: //row index (readonly) cell: //column index (readonly) style: //given element style TD cls: // given element class css TD // 3.1.7+ encode: // whether to encode characters html (by default true) }
metaData.encode parameter can be used if you want to insert html tags in your cell. In this case, we must take care of encoding the value entered by the user.
The function can return a value that will be entered into the cell (unless other rendering functions called later will change this value. Example: // Renderer registration var vss = ServiceFactory.getVariableSetService(); vss.addRenderer(vss.get(0), function(value, data, column, metaData){ // give style based on value variable1 metaData.style = 'color: ' + value; // or data[column] // give class based on value variable2 metaData.cls = data['variable2']; // giving a new value return 'rendered:' + value; }, ['variable1']); // renderer for the given column |
columns | String[] | All table columns | An array of variable identifiers (columns) for which this rendering function is to be valid. If you omit this parameter, the function will apply to all variables. |
Function result:null
removeRenderers (from 3.1.6) - removes all rendering functions from the given dynamic table variable
Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
columns | String[] | All table columns | An array of variable identifiers (columns) from which to delete all rendering functions. |
- Function result:null
selectAll (from 3.1.8) - marks all records from the dynamic table (note: this involves adding a specific css class to each record, records are not returned byselModel.getSelection()).
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function result:null
deselectAll (from 3.1.8) - deselects all records from the dynamic table (note: this involves deleting a particular css class from each record).
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table componen |
Function result:null
getAllSelected(from 3.1.8) - returns all selected records (using function selectAll, that is, having a specific css class).
Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function result:
Type | Description |
---|---|
Ext.data.Model[] | Table of selected records |
minimize (from 3.1.25) - minimizes the dynamic table.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function result:null
maximize (from 3.1.25) - maximizes the dynamic table.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variableSet | Suncode.form.view.gadget.variableset.VariableSet | null | Dynamic table component |
Function result:null