SMART datagrid v.1 > Classes > EditOptions

Back  Forward

DataLudi.EditOptions.pasteCallback  property

Callback function which converts the text to field value when pasting the text of clipboard to data cell. 

function (row:GridRow, column:GridColumn, field:DataField, text:String):*;

It takes precedence over the conversion format properties like EditOptions.pasteDatetimeFormats. If specify ValueColumn.pasteCallback of column, this property will be ignored. 

Defaults to null.

Getter
function pasteCallback(): Function
Setter
function setPasteCallback(value: Function)
Code -1
    grid.setOptions({
        edit: {
            pasteCallback: function (row, column, field, text) {
                if (field.fieldName() == 'amount') {
                    return text ? parseFloat(text) : 100;
                }
                return field.readValue(text);
            });
        }
    });
Code -2
    grid.setEditOptions({
        pasteCallback: function (row, column, field, text) {
            if (field.fieldName() == 'amount') {
                return text ? parseFloat(text) : 100;
            }
            return field.readValue(text);
        });
    });
Code -3
    grid.editOptions().setPasteCallback(function (row, column, field, text) {
        if (field.fieldName() == 'amount') {
            return text ? parseFloat(text) : 100;
        }
        return field.readValue(text);
    });
    
See Also
ValueColumn.pasteCallback
pasteBooleanFormat
pasteDatetimeFormats
pasteNumberChars
DataField
Examples
Clipboard Paste
Clipboard Copy