Reputation: 41
I am trying to develop some drag and drop functionality. First, I just want the thing to drag. I'm reading a book "Getting Started with Dojo, Kyle Hayes", but am having no luck.
Some of my problems:
djConfig="parseOnLoad
in my initial script calling an older library from Google, nothing works. If I take out the djConfig="parseOnLoad
, then the page begins to work.dojo.require("dojo.dnd.Target")
, I lose all functionality.I have included my code below, and sincerely appreciate any help anyone can give me in getting started.
<!DOCTYPE HTML>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js" djConfig="parseOnLoad: true"></script>
<script type="text/javascript">
//dojo.require("dojo.parser");
dojo.require("dojo.dnd.move");
dojo.require("dojo.dnd.Source");
//dojo.require("dojo.dnd.Target");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.TextBox");
document.write("I got this far");
var init = function()
{
dojo.connect(
dojo.byId('btnSayHello'),
"onclick",
this,
helloButton_onClick
);
}
var helloButton_onClick = function(event)
{
alert ('Hello World and hello ' + dojo.byId('txtName').value + '!');
}
dojo.addOnLoad(init);
</script>
</head>
<body>
<div id="dragMe" dojoType="dojo.dnd.move" style="border: 1 solid black; height: 300; width: 300;">
Source 1
</div>
<div id=Div1 dojoType="dojo.dnd.Target" style="border: 1 solid black; height: 300; width: 300;">
Target
</div>
<div>
<h1>Hello World Example</h1>
<hr/>
<label for="txtName">Your name:</label>
<input id="txtName" type="text" dojoType="dijit.form.TextBox"/><br/>
<button id="btnSayHello" dojoType="dijit.form.Button">Say Hello</button>
</body>
</html>
Upvotes: 0
Views: 203
Reputation: 198
I just changed from dojoType="dojo.dnd.move"
to dojoType="dojo.dnd.Moveable"
and I can drag it around. Hope it helps.
Upvotes: 1