To enable copying and pasting DataTable data by the CTRL+C/CTRL+V keyboard shortcuts you should use the clipboard parameter.
The parameter can have the following values:
Setting the desired behavior of copying
webix.ui({
view:"datatable",
clipboard:"selection",
});
Related sample: Copying between Grids
webix.ui({
view:"datatable",
clipboard:true, // or "block"
});
How it works:
Related sample: 'Block' Copying
webix.ui({
view:"datatable",
clipboard:"selection",
});
How it works:
Related sample: 'Selection' Copying
webix.ui({
view:"datatable",
clipboard:"repeat",
});
How it works:
Related sample: 'Repeat' Copying
"custom" clipboard allows you to specify custom logic for the copy-paste operation.
grid = webix.ui({
view:"datatable",
clipboard:"custom",
select:"row",
autoConfig:true,
data:grid_data
});
This will cancel the predefined behavior for the paste operation. That's why you will need to specify custom logic in the onPaste event handler. E.g.:
grid.attachEvent("onPaste", function(text) {
// define your pasting logic here
var sel = this.getSelectedId(true);
sel.forEach(item => {
this.getItem(item.row)[item.column] = "test";
this.refresh(item.row);
});
});
onPaste is called when the user presses CTRL+V.
Related sample: Custom Clipboard (Datatable)
Back to top