CopyPasteBase

Base copy-paste functionality for row-based widgets. Not to be used directly.

Configs

17

Common

disabledInstancePlugin
listenersEvents

Other

copyOnly: Boolean

If true this prevents cutting and pasting. Will default to true if CellEdit feature is disabled. Set to false to prevent this behaviour.

dateFormat: String

The format a copied date value should have when converted to a string. To learn more about available formats, check out DateHelper docs.

emptyValueChar: String=

If an empty value (null or empty string) is copied or cut, this config will replace that value. This allows for clipboard data to skip columns.

For example, look at these two selections

ROW 0 1 2 3
ROW 1 SEL1 not selected not selected SEL2
ROW 2 SEL3 SEL4 (empty) SEL5 (empty) SEL6

The clipboardData for ROW 1 will look like this: * SEL1\t\t\SEl2\nSEL3\t\t\SEL4

And ROW 2 will look like this: SEL3\t\u{0020}\t\u{0020}\tSEL6

ROW 1 will set value SEL1 at column index 0 and SEL2 at column index 3. This leaves column index 1 and 2 untouched.

ROW 2 will set value SEL3 at column index 0, u{0020} at column index 1 and 2, and SEL6 at column index 3.

The default u{0020} is a blank space.

Note that this only applies when copy-pasting cell values or copying rows from other Bryntum component instances or from native clipboard.

A method used to generate the name for a copy-pasted record. By defaults appends "- 2", "- 3" as a suffix. Override it to provide your own naming of pasted records.

ParameterTypeDescription
recordModel

The new record being pasted

originalRecordModel

The record that was copied

Returns: String
keyMap: Object<String, KeyMapConfig>

Default keyMap configuration: Ctrl/Cmd+c to copy, Ctrl/Cmd+x to cut and Ctrl/Cmd+v to paste. These keyboard shortcuts require a selection to be made.

toCopyString: function

Provide a function to be able to customize the string value which is copied

new Grid({
    features : {
        cellCopyPaste : {
            toCopyString({currentValue, column, record}) {
                if(record.isAvatar){
                    return record.fullName;
                }
                return currentValue;
            }
        }
    }
});

Note that this function is only called when copying cell values or copying values from other Bryntum component instances or from native clipboard.

ParameterTypeDescription
dataObject
data.currentValueString
data.columnColumn
data.recordModel
Returns: String
toPasteValue: function

Provide a function to be able to customize the value which will be set onto the record

new Grid({
    features : {
        cellCopyPaste : {
            toPasteValue({currentValue, column, record, field}) {
                if(typeof currentValue === 'string'){
                    return currentValue.replace('$', '');
                }
                return currentValue;
            }
        }
    }
});

Note that this function is only called when pasting string values, either from CellCopyPaste or copying values from other Bryntum component instances or from native clipboard.

ParameterTypeDescription
dataObject
data.currentValueString
data.columnColumn
data.recordModel
Returns: String
useNativeClipboard: Boolean= false

Set this to false to not use native Clipboard API even if it is available

Misc

clientInstancePlugin
localeClassLocalizable
localizableLocalizable

Properties

17

Common

disabledInstancePlugin

Class hierarchy

isCopyPasteBase: Boolean= truereadonly
Identifies an object as an instance of CopyPasteBase class, or subclass thereof.
isCopyPasteBase: Boolean= truereadonlystatic
Identifies an object as an instance of CopyPasteBase class, or subclass thereof.
isClipboardableClipboardable
isEventsEvents
isInstancePluginInstancePlugin
isLocalizableLocalizable

Other

A method used to generate the name for a copy-pasted record. By defaults appends "- 2", "- 3" as a suffix. Override it to provide your own naming of pasted records.

ParameterTypeDescription
recordModel

The new record being pasted

originalRecordModel

The record that was copied

Returns: String

Lifecycle

configBase

Misc

clientInstancePlugin
localeHelperLocalizable
localeManagerLocalizable

Functions

29

Common

clearClipboardClipboardable

Configuration

applyDefaultsstaticBase

Events

Lifecycle

destroystaticBase

Misc

doDisableInstancePlugin
initClassstaticBase
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

Other

LstaticLocalizable
onEvents
relayAllEvents
triggerEvents
unEvents

Events

5
catchAllEvents
destroyEvents
disableInstancePlugin
enableInstancePlugin

Event handlers

5
onDestroyEvents
onDisableInstancePlugin
onEnableInstancePlugin

Typedefs

1