DataTable Events for Views and Apps
DataTables have a single event, rowselect, of interest to views and basic apps. This event indicates that one row of data in results has been selected by the user, typically through the user interface of a view within the app. If the app is part of a workspace, however, this change in row selection can also come from messages published by another app that are wired to the rowselect subscription topic.
Views can both trigger and listen for DataTable
rowselect events, allowing all interested views that are using a DataTable to synchronize their selection state across the app. Basic apps also listen for
rowselect events in the DataTable and then publish messages to the
rowselect topic or trigger
rowselect events in the DataTable as the result of messages received from other apps in the
rowselect subscription topic. Subscriptions to
rowselect topics can also be used to synchronize app state when the workspace initially loads (see
Synchronizing Wired Apps When a Workspace Loads for information).
Note: Wiring in a workspace app that ties rowselect events in the DataTable for one app to row selection for DataTables in other apps is possible, but may not always be consistent. Pagination in a DataTable can cause matches to be missed. Multiple matches will also not be found as the selection model for the DataTable is a single selection.
MashZone NextGen built-in views that support some type of 'click' event both trigger and listen for DataTable
rowselect events. Pluggable views can also choose to trigger or listen for this event. See
Pluggable View Classes: Triggering and Handling Events for more information.
A rowselect event includes these properties:
rowIndex = the index number of the row for this event
selected = a boolean indicating whether this row should be selected (true) or not (false)
rowData = a row object with the data for this row
When a view indicates a row has been clicked, the DataTable fires one or two rowselect events:
For the existing selected row, if any, an event with
selected = false to clear selection for this row.
If the clicked row is not the existing selected row, an event with
selected = true to set the selected state for this new row.