OpenFin Plugin
The OpenFin Plugin provides extra functionality for users when AdapTable is running in the OpenFin container.
Setup
To set up the plugin and access the OpenFin Api object, follow these steps:
Import the plugin:
import openfin from '@adaptabletools/adaptable-plugin-openfin';Import the OpenFin Api:
import { OpenFinApi } from '@adaptabletools/adaptable/types';
Create the OpenFinPluginOptions as appropriate:
const openfinPluginOptions: OpenFinPluginOptions = {notificationTimeout: false,showApplicationIconInNotifications: true,}Specify the Plugin in Adaptable Options passing in the Options set up in previous step:
const adaptableOptions: AdaptableOptions = {adaptableId: 'openfindemo',plugins: [openfin(openfinPluginOptions),]// ... other options}note
In this example we have set the
throttleTime
property in OpenFinPlugin OptionsAccess the Open Fin Api via the main Adaptable Api object and use as needed:
const openfinApi: OpenFinApi = adaptableApi.pluginsApi.getPluginApi('openfin');
OpenFin Toolbar
The OpenFin Plugin makes a dedicated Dashboard Toolbar called 'OpenFin' available.
important
This makes it possible to run Live Reports in Excel
The Toolbar can be referenced in Dashboard Predefined Config as follows:
Live Reports
One feature available when AdapTable is running in the OpenFin Plugin is Live Export via Excel.
This enables grid data to be sent from AdapTable to Excel with 2 way updates:
note
Any Reports created in the Export function will appear in the Toolbar
- Excel will automatically update in line with cell edits and ticking data changes in AdapTable
- Any date edits made directly in Excel will be automatically reflected in AdapTable
tip
Live Reports can, like all Reports, be set to run on a Schedule.
To make this functionality available, specify the following in the app.json file:
Validating Excel Changes
The Cell Validation Function in AdapTable enables custom Validation Rules to be provided which are checked after each Data Change.
When running Live Reports these validation rules can be extended to edits made in Excel also by setting the onValidationFailureInExcel
property in OpenFinPluginOptions.
This property can take one of 3 values:
override: automatically updates Excel with the previous value (i.e. before the edit was made)
show-notification: displays an Open Notification explaining that the edit in Excel broke validation
show-undo-notification: displays an Open Notification containing a button; when clicked AdapTable will override the edit in Excel with the previous value
OpenFin Notifications
AdapTable can enable OpenFin Notifications to display if required.
When using the OpenFin Plugin an extra option is displayed in the Alert UI, which allows the Alert to be shown as an Open Notification in the systray.
tip
This can be configured at design-time through the ShowInOpenFin property in Alert Properties
Managing Notifications
There are 4 properties (2 of them JavaScript functions) in OpenFinPluginOptions which help to manage how OpenFin notifications will look and work.
notificationTimeout - when OpenFin notifications will expire after being displayed
showAppIconInNotifications - displays App Icon (supplied in User Interface Options) in the notification
onNotificationAction - function invoked when a button in an OpenFin notification is clicked
onShowNotification - function which custom updates an OpenFin notification before it is displayed
Using Notifications Example
The example below taken from the OpenFin Demo App illustrates:
- 2 buttons being added to the Notification when it renders: "jump-to-cell" and "increase-limit"
- if action is "increase-limit" the Adaptable Alert Definition is updated via the Alert Api
- if action is "jump-to-cell" the
jumpToCell
andhighlightCell
methods of Grid Api are invoked