Shortcut Module

The Shortcut Module helps to avoid fat finger issues and to speed up data entry for numeric columns.

Defining a Shortcut

A Shortcut defines which mathematical calculation is applied to the currently edited (numeric) cell when a given key is pressed.

PropertyDescription
ScopeOn which numeric Columns the Rule is applied
ShortcutKeyKey which triggers the Shortcut when pressed
ShortcutOperationThe Operation: 'Add', 'Subtract', 'Multiply', 'Divide'
ShortcutValueValue which acts as 2nd operand for ShortcutOperation (the first operand being the cell value)

As can be seen it comprises 4 elements:

Scope

Which numeric Columns will use the Shortcut.

tip

This can be set to be DataType of 'Numeric' so that it applies to all

Operation

The mathmatical operation to undertake. There are 4 potential values:

  • Add
  • Subtract
  • Multiply (the default)
  • Divide

Key

The key to use to trigger the Shortcut

note

This has to be a letter of the alphabet.

Value

The numeric value to use in the mathmetical operation when the shortcut is applied

Putting it together

Here we define 2 Shortcuts which will happen when a key is pressed in the numeric cell editor:

  • 'm' - for any numeric column - will multiply current edit value by 1000 (e.g. 5'm' produces 5,000)
  • 'v' - for the 'amount' column - will multiply current edit value by 1.175 (e.g. 100'v' produces 117.5)
const demoConfig: PredefinedConfig = {
Shortcut: {
Shortcuts: [
{
Scope: {
DataTypes: ['Number'],
},
ShortcutKey: 'm',
ShortcutValue: 1000,
ShortcutOperation: MathOperation.Multiply,
},
{
Scope: {
ColumnIds: ['amount'],
},
ShortcutKey: 'v',
ShortcutValue: 1.175,
ShortcutOperation: MathOperation.Multiply,
},
],
},
};

UI Elements

Shortcut includes the following UI Elements:

  • Popup - Shows a list of existing Shortcuts with a Delete button. Plus an Add button to start the Shortcut Wizard which facilitates the creation and editing of Shortcuts.

UI Entitlements

UI Entitlements behaviour is as expected for Full and Hidden Access Levels.

The ReadOnly Entitlement behaviour is that Shortcuts will be applied but Users cannot manage or suspend them.

Shortcut State

The Shortcut Config contains a collection of Shortcuts:

PropertyDescription
ShortcutsCollection of Shortcuts - designed to speed up data entry

Shortcut Object

The Shortcut object is defined as follows:

PropertyDescription
ScopeOn which numeric Columns the Rule is applied
ShortcutKeyKey which triggers the Shortcut when pressed
ShortcutOperationThe Operation: 'Add', 'Subtract', 'Multiply', 'Divide'
ShortcutValueValue which acts as 2nd operand for ShortcutOperation (the first operand being the cell value)

Shortcut API

MethodDescription
addShortcut(shortcut)Adds new Shortcut to the state
deleteAllShortcut()Deletes all Shortcuts in Adaptable State
deleteShortcut(shortcut)Deletes Shortcut from the state
getAllActiveShortcut()Gets all active (not-suspended) Shortcuts in Adaptable State
getAllShortcut()Gets all Shortcuts in Adaptable State
getAllSuspendedShortcut()Gets all suspended Shortcuts in Adaptable State
getShortcutById(id)Retrieves Shortcut by Id
getShortcutState()Retrieves Shortcut section from Adaptable State
showShortcutPopup()Opens Shortcut popup screen
suspendShortcut(shortcut)Suspends Shortcut definition
unSuspendShortcut(shortcut)Activates a suspended Shortcut definition

FAQ

Can we apply shortcuts on non-numeric columns?

No, Shortcuts only work for numeric columns.

More Information