To enable the possibility to copy/paste Tree data by the CTRL+C/CTRL+V keyboard shortcuts, you should use the clipboard parameter.
The parameter can have one of 3 values:
Each of the types has its specificity and defines its behavior of copying.
Setting the desired behavior of copying
tree = webix.ui({
view:"tree",
clipboard:"insert"
});
Related sample: Pasting New Items
It's the default type, you can also set it to true.
This mode works like this:
Setting the 'modify' behavior of copying
tree = webix.ui({
view:"tree",
clipboard:true
});
Related sample: Pasting Titles of Tree Items
Setting the 'insert' behavior of copying
tree = webix.ui({
view:"tree",
clipboard:"insert"
});
Related sample: Pasting New Items
Mode 'custom' allows you to specify custom logic for pasting.
To apply custom 'paste' behavior to the tree:
1. Set the clipboard parameter to "custom".
var tree = webix.ui({
view:"tree",
clipboard:"custom"
});
This command will cancel the predefined behavior for the paste operation.
2. Specify custom logic in the onPaste event handler.
//the code does nothing but alerts messages
tree.attachEvent("onPaste", function(text) {
webix.message("Node is pasted: " + text);
});
Tree invokes the onPaste event when the user presses CTRL+V keys combination.
Related sample: Custom Clipboard Operations
Back to top