Hey,
Complete beginner here with Webix but really liking what they’re doing!
I’ve knocked together my first basic test app, so far so good. Now I would like to make it a little more intelligent and I’m after some help please?
I have a tree with two parent nodes, Section1 and Section2. Each parent has a couple of child nodes (options) and I’d like to be able to drag n drop Section1’s children onto Section1’s list and Sections2’s children onto Sections2’s list. What I don’t want to be able to do is drag Section1’s children into Section2’s list or vice versa, so I’d like to code some constraints to stop this from happening.
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript" src="http://cdn.webix.com/edge/webix.js"></script>
<link rel="stylesheet" href="http://cdn.webix.com/edge/webix.css">
</head>
<body>
<script type="text/javascript" charset="utf-8">
webix.ui({
rows:[
{ type:"header", template:"My App!" },
{ cols:[
{ view:"tree",id: "0",drag:"source",
data: [
{ id:"1", open:true, value:"Section1",
data:[
{ id:"1.1", value:"Option1" },
{ id:"1.2", value:"Option2" },
{ id:"1.3", value:"Option3" }
]
},
{ id:"2", open:true, value:"Section2",
data:[
{ id:"2.1", value:"Option1" },
{ id:"2.2", value:"Option2" },
{ id:"2.3", value:"Option3" },
{ id:"2.4", value:"Option4" }
]
},
],gravity:0.325, select:true },
{view:"resizer" },
{rows:[
{view:"list",drag:"target",
data: [
{id:"3", value:"Only Section1 Options can be dropped here:"}
],gravity:0.25,scroll:false
},
{ view:"resizer" },
{view:"list",drag:"target",
data: [
{id:"4", value:"Only Section2 Options can be dropped here:"}
],gravity:0.35
},
{ view:"resizer" },
{view:"list",
data: [
{id:"5", value:"This is for results - no drops here:"}
]
}
]
}
]
}
]
})
</script>
</body>
</html>
Has anyone any ideas how to do this? Also how can I setup the tree items to copy when they’re dragged and not moved.
Many Thanks for any help,
Slash.