Perspective Component Events
Perspective Event Types Reference
page describes all the possible component event types for Perspective components. Not all component events support each Perspective component. The
Component Events and Actions
page shows how to configure events and actions on a Perspective component. Component scripting is handled separately and can be accessed from the Component menubar or by right clicking on the component.
onEditCellCommit
This onEditCellCommit event is used with a runAction script on a table to take user entry and store it in the table or a database.
Provides a chance do something once a user has typed something into a cell. The user must commit the new value before the event will trigger. "Committing" a value depends on the type of value and how it's rendered. Numerical and text values can be committed by pressing "Enter" after typing a new value. Boolean values are typically committed via a click (such as in cases when the cell is rendered as a checkbox or toggle switches).
Additionally, the cell must first be editable (
props.data.[rowNumber].[columnName].editable
is set to true). The first cell in the default dataset on a newly created instance of the component demonstrates where the
editable
property must be positioned.
Note:
This component event is designed to be used in tandem with a script runAction. Within the script action, special properties and methods are available on the
event
object, which is passed to the script action as a parameter.
event.column
String
The name of the column under which the cell was edited.
event.row
Number
The unique row index as it is represented in the source data. Also known as the row ID.
event.value
Any
The value that was typed into the cell.
# This example will set the value of a cell, based on what the user typed into it.
# Get the value that was typed into the cell
valueToSet = event.value
# We need to set a value in a particular cell. The event object contains row and column properties
# that report the position of the cell that was edited.
# If the data property contains an array, you would use the line below
self.props.data[event.row][event.column] = valueToSet
# If the data property contains a dataset, then you would want to use the following line instead
#self.props.data = system.dataset.setValue(self.props.data, event.row, event.column, valueToSet)
onSelectionChange
This onSelectionChange event will trigger when the selection in the chart changes.
Note:
The onSelectionChange event will fire on startup or mount if props do not equal the table components default selection config.
This component event is designed to be used in tandem with a script runAction. Within the script action, special properties and methods are available on the
event
object, which is passed to the script action as a parameter.
event.selectedColumn
String or null
The name of the column that the selected cell is located under.
event.selectedRow
Number or null
The unique row index as it is represented in the source data. Also known as the row ID.
event.data
Array
Represents the currently selected entries. The contents of the array is based on the enabledRowSelection and enableColumnSelection properties as represented on the table below. The actual resulting value may include additional values if the selection mode on the table is set to "single interval" or "multiple interval".
enabledRowSelection
|
enableColumnSelection
|
Resulting return type
|
Example Output
|
True
|
False
|
An array containing a number of JSON objects that each represent a single row.
Each JSON object contains one key-value pair for each column on the table.
|
[{"city":"Folsom","country":"United States", "population":77271}]
|
False
|
True
|
An array of JSON objects, where each object represents a separate row in the selected column.
Each object contains a single key-value pair, where the key is the column name and the value is the value of the cell.
|
[{"city":"Folsom"}, {"city":"Helsinki"},
{"city":"Jakarta"},]
|
True
|
True
|
An array containing a single JSON object, which can be treated like a Python dictionary.
|
|
onEditCellStart
This onEditCellStart event fires when the user starts editing a cell. For onEditCellStart, the value is the initial value before any edits.
Note:
This component event is designed to be used in tandem with a script runAction. Within the script action, special properties and methods are available on the
event
object, which is passed to the script action as a parameter.
event.column
String or number
The column the editing cell is positioned under.
event.row
Number
The unique row index as it is represented in the source data. Also known as the row ID.
event.rowIndex
Number
The row index as it is represented in the current visible data. Useful in cases where some of the rows are hidden, such as when filtering.
event.value
Any
The value of the cell before editing began.
onEditCellCancel
This onEditCellCancel event is fired when the user has canceled a cell edit and has exited editing mode by effectively pressing the escape key.
Note:
This component event is designed to be used in tandem with a script runAction. Within the script action, special properties and methods are available on the
event
object, which is passed to the script action as a parameter.
event.column
String
The column name of the cell being edited.
event.row
Number
The unique row index as it is represented in the source data. Also known as the row ID.
event.rowIndex
Number
The row index as it is represented in the current visible data. Useful in cases where some of the rows are hidden, such as when filtering.
event.value
Any
The value of the cell before editing began.
onRowClick
This onRowClick event is f
ired when a row in the table is clicked.
Note:
This component event is designed to be used in tandem with a script runAction. Within the script action, special properties and methods are available on the
event
object, which is passed to the script action as a parameter.
event.row
Number
The unique row index as it is represented in the source data. Also known as the row ID.
event.rowIndex
Number
The row index as it is represented in the current visible data. Useful in cases where some of the rows are hidden, such as when filtering.
event.value
PlainObject
The rows value as a JSON object.
onRowDoubleClick
This onRowDoubleClick event is triggered when a row in the table is double clicked.
Note:
This component event is designed to be used in tandem with a script runAction. Within the script action, special properties and methods are available on the
event
object, which is passed to the script action as a parameter.
event.row
Number
The unique row index as it is represented in the source data. Also known as the row ID.
event.rowIndex
Number
The row index as it is represented in the current visible data. Useful in cases where some of the rows are hidden, such as when filtering.
event.value
PlainObject
The rows value as a JSON object.
onSubviewExpand
This onSubviewExpand event is triggered when a row subview is expanded.
Note:
This component event is designed to be used in tandem with a script runAction. Within the script action, special properties and methods are available on the
event
object, which is passed to the script action as a parameter.
event.row
Number
The unique row index as it is represented in the source data. Also known as the row ID.
event.rowIndex
Number
The row index as it is represented in the current visible data. Useful in cases where some of the rows are hidden, such as when filtering.
event.value
PlainObject
The rows value as a JSON object.
onSubviewCollapse
This onSubviewCollapse event
is triggered when a row subview is collapsed.
Note:
This component event is designed to be used in tandem with a script runAction. Within the script action, special properties and methods are available on the
event
object, which is passed to the script action as a parameter.
event.row
Number
The unique row index as it is represented in the source data. Also known as the row ID.
event.rowIndex
Number
The row index as it is represented in the current visible data. Useful in cases where some of the rows are hidden, such as when filtering.
event.value
PlainObject
The rows value as a JSON object.
The following feature is new in Ignition version
8.1.17
Click here
to check out the other new features
This function will collapse the specified row subviews. If no parameter is specified, this function will collapse all expanded subviews on the current page.
array
rows - An optional array of indices of rows to collapse
. Any argument that is not a list will throw an exception. A list of invalid indices will not throw an exception. Omitting this parameter will collapse all subviews.
Note:
Specifying a number of rows to collapse when using this function will now affect the actual number specified, instead of stopping at the end of the currently displayed page.
Additionally, there is a distinction between using
row
and
rowIndex
.
Row
refers to the true index of the row as it exists in the data, and is not affected by paging, sorting, or searching.
RowIndex
refers to the visual index of the row as it appears on the table and is affected by paging, sorting, and searching.
# Collapse subviews for rows 1 and 3 if they exist. If the list does not match any indices that exist, nothing will happen.
self.getSibling('Table').collapseSubviews([1, 3])
# Collapse all expanded subviews.
self.getSibling('Table').collapseSubviews()
# The following lines are invalid and will throw an exception:
self.getSibling('Table').collapseSubviews(None)
self.getSibling('Table').collapseSubviews(3)
.expandSubviews()
The following feature is new in Ignition version
8.1.17
Click here
to check out the other new features
This function will expand the specified row subviews. This will only expand rows that are visible on the current page.
array
rows - An array of indices of rows to expand.
Any argument that is not a list will throw an exception. A list of invalid indices will not throw an exception. Omitting this parameter will expand all subviews.
Note:
Specifying a number of rows to expand when using this function will now affect the actual number specified, instead of stopping at the end of the currently displayed page.
Additionally, there is a distinction between using
row
and
rowIndex
.
Row
refers to the true index of the row as it exists in the data, and is not affected by paging, sorting, or searching.
RowIndex
refers to the visual index of the row as it appears on the table and is affected by paging, sorting, and searching.
# Expand subviews for rows 1 and 3 if they exist. If the list does not match any indices that exist, nothing will happen.
self.getSibling('Table').expandSubviews([1, 3])
# Expand all subviews.
self.getSibling('Table').expandSubviews()
# The following lines are invalid and will throw an exception:
self.getSibling('Table').expandSubviews(None)
self.getSibling('Table').expandSubviews(3)
Powered by
Printed by Atlassian Confluence 7.19.17