CopyPasteBase
Base copy-paste functionality for row-based widgets. Not to be used directly.
Configs
17
Configs
17Other
If true this prevents cutting and pasting. Will default to true if CellEdit feature
is disabled. Set to false to prevent this behaviour.
The format a copied date value should have when converted to a string. To learn more about available formats, check out DateHelper docs.
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.
| Parameter | Type | Description |
|---|---|---|
record | Model | The new record being pasted |
originalRecord | Model | The record that was copied |
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.
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.
| Parameter | Type | Description |
|---|---|---|
data | Object | |
data.currentValue | String | |
data.column | Column | |
data.record | Model |
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.
| Parameter | Type | Description |
|---|---|---|
data | Object | |
data.currentValue | String | |
data.column | Column | |
data.record | Model |
Set this to false to not use native Clipboard API even if it is available