When the user pressed ctrl+v keys, in order to paste the values of the clipboard to the selected area of the grid, pasteEnabled property of grid editOptions should be set as true first. At this point, if singlePaste is true, it will only paste in Focused Cell rather than all values.
The default value is true. The default value is false.
In order to save the clipboard text as the data cell values rather than TEXT field, you may need to convert the format, and it can be resolved in various ways. First, you can specify the callback function in pasteCallback property of the column. It has been set in "Interest Rate" column as below.
col.setPasteCallback(function (row, field, text) {
var v = parseFloat(text);
return isNaN(v) ? 1.0 : v;
});
And, you can also specify editOptions.pasteCallback in the grid level. It will be ignored if column pasteCallback is specified.
grid.setEditOptions({
pasteCallback: function (row, column, field, text) {
var v;
switch (field.fieldName()) {
case 'country':
v = text && text.indexOf('X_') != 0 ? 'X_' + text : text;
break;
default:
v = field.readValue(text);
break;
}
return v;
}
});
If the callback functions are not specified, you can specify the conversion format in editOptions according to the dataType of the field. In the grid below, EditOptions.pasteDatetimeFormats, pasteBooleanFormat, pasteNumberChars have been specified as in the code below.
grid.setEditOptions({
pasteDatetimeFormats: ['yyyy-MM-dd', 'yyyyMMdd'],
pasteBooleanFormat: "false,f:true,t:",
pasteNumberChars: "$w,abcd"
});
One or more date conversion formats can be specified, and pasteNumberChars specify the characters which will be excluded from the original text, so that the string can be changed to number in NUMBER.