EditTriggers / PartialEditTriggers interface
Description
An EditTriggers is an interface that exposes the properties available for an EditTriggers, to start the edit mode.
Properties
|
Property |
Type |
Description |
|---|---|---|
|
onKeyPress |
|
The function which will evaluate if the current key press can start edit mode. When null, no key press can start edit mode. |
|
onMouseAction |
|
The function which will evaluate if the mouse action can start edit mode. When null, no mouse action can start edit mode. |
|
onNavigationFocus |
|
The function which will evaluate if the current key press can start edit mode while navigating. When null, no key press can start edit mode while navigating. |
Example
In this example, the keyStartEdit function defines an edit mode when the key “p” or Alt + “n” is pressed. This function is set as the EditTriggers.onKeyPress. The edit mode will also be active on a mouse double-click or a focus-in from a tab key, because set in the EditTrigger.onMouseAction and EditTriggers.onNavigationFocus.
function keyStartEdit(context)
{
if (context.keyPressed === "p")
return true;
if (context.keyPressed === "n" && context.isAltKeyPressed)
return true;
return false;
}
const editTriggers = {
onMouseAction: Xceed.EditTriggers.onMouseAction.doubleClick,
onKeyPress: keyStartEdit,
onNavigationFocus: Xceed.EditTriggers.onNavigationFocus.tab
};
This editTriggers object should be set in the DataGridOptions.editTriggers property.
Remark
To start edit, the DataGridOptions.allowEdit must be set to true (or on the wanted ColumnDefinition(s) with their allowEdit property set to true).
A partial type/interface is an object in which properties are optional.