SMART datagrid v.1 > Examples

Back  Forward

Clipboard Copy  Example

You can copy the data cell area of the grid and paste it in the system clipboard, or get the text from the clipboard and paste it in the grid. It is to use ctrl+c and ctrl+v key entry event in the browser, and does not provide a function to approach the clipboard without the user input. When the user pressed ctrl+c keys, in order to copy the selected data cell area of the grid to the system clipboard, copyEnabled property of grid editOptions should be set as true first. At this point, if singleCopy is true, you can only copy the value of Focused Cell rather than the entire selected area. 

The default value is true.  The default value is false. 

Grid - 1
rows

When transfer the field value which is not TEXt to the clipboard, you can specify the converting string in various ways. First, you can specify copyCallback in each column. In the example, it has been set in "Interest Rate" column. 

Code -1
    col.setCopyCallback(function (row, field, value) {
        return '$' + value;
    };

And, you can also specify the callback function in copyCallback of GridBase.editOptions

Code -2
    grid.setEditOptions({
        copyCallback: function (row, field, value) {
            if (field.fieldName() == "amount") {
                return '$' + value;
            }
            return value;
        };
    });

If copyCallback is specified in the column, copyCallback of editOptions will be ignored. Instead of copyCallback, EditOptions.copyNumberFormat, copyDatetimeFormatcopyBooleanFormat will be used as a conversion format when each field value is being converted to a string. 

If these conversion formats are not specified and editOptions.useStyleFormats are specified as trueGridStyles.numberFormat, datetimeFormat, booleanFormat settings will be used. 

The default value is true. You can test it in "Original Amount" and "First Date" columns. 

View Source JSP 

See Also
GridBase.editOptions
GridStyles.datetimeFormat
GridStyles.numberFormat
GridStyles.booleanFormat
GridColumn.styles
ValueColumn.copyCallback
EditOptions.copyCallback
EditOptions.copyDatetimeFormat
EditOptions.copyNumberFormat
EditOptions.copyBooleanFormat
Examples
Clipboard Paste
Cell Editing