Copying DataTree Items,JavaScript Programming Example of Copying DataTree Items

JavaScript Programming Example of Copying DataTree Items

Check out the programming example for copying DataTree items. The code below allows you to select an item in DataTree, copy it by means of ctrl+c, and paste the copied text into the textarea using ctrl+v. You are welcome to use our free coding samples for building your own web apps.

JS Code

var tpl = "<strong>Copying DataTree Items</strong><br><br>"+
    "Select an item and press ctrl+c (the item will be copied).<br>"+
	"Set the cursor into the textarea and press ctrl+v (to paste the copied item).";

webix.ui({
  type:"clean",
  rows:[
    {template:tpl,height:100},
    { height:200, type:"clean",
      cols:[
    {	
      view:"tree",
      width:300,
      select: true,
      clipboard: true,
      data: [
        { id:"1", open:true, value:"The Shawshank Redemption", data:[
          { id:"1.1", value:"Part 1" },
          { id:"1.2", value:"Part 2" },
          { id:"1.3", value:"Part 3" }
        ]},
        { id:"2", value:"The Godfather", data:[
          { id:"2.1", value:"Part 1" },
          { id:"2.2", value:"Part 2" }
        ]}
      ]
    },
      {view:"textarea",placeholder:"Paste the copied text here",width:300}
    ]}
  ]
});