aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/dtl/demos/demo_Events.html
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
commite44a7e37b6c7b5961adaffc62b9042b8d442938e (patch)
tree95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojox/dtl/demos/demo_Events.html
parenta62b9742ee5e28bcec6872d88f50f25b820914f6 (diff)
downloadsemanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz
semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/dtl/demos/demo_Events.html')
-rw-r--r--includes/js/dojox/dtl/demos/demo_Events.html46
1 files changed, 46 insertions, 0 deletions
diff --git a/includes/js/dojox/dtl/demos/demo_Events.html b/includes/js/dojox/dtl/demos/demo_Events.html
new file mode 100644
index 0000000..aa3da46
--- /dev/null
+++ b/includes/js/dojox/dtl/demos/demo_Events.html
@@ -0,0 +1,46 @@
+<html>
+ <head>
+ <title>Demo using dojox.dtl._Templated</title>
+ <script type="text/javascript" src="../../../dojo/dojo.js"
+ djConfig="isDebug: true, parseOnLoad: true"></script>
+ <script type="text/javascript" src="../../../dijit/dijit.js"></script>
+ <style type="text/css">
+ @import "../../../dijit/themes/tundra/tundra.css";
+ </style>
+ <script type="text/javascript">
+ dojo.require("dojox.dtl._HtmlTemplated");
+ dojo.require("dijit.form.Button");
+
+ dojo.declare("Fruit", [dijit._Widget, dojox.dtl._HtmlTemplated], {
+ widgetsInTemplate: true,
+ items: ["apple", "banana", "orange"],
+ keyUp: function(e){
+ if((e.type == "click" || e.keyCode == dojo.keys.ENTER) && this.input.value){
+ var i = dojo.indexOf(this.items, this.input.value);
+ if(i != -1){
+ this.items.splice(i, 1);
+ }else{
+ this.items.push(this.input.value);
+ }
+ this.input.value = "";
+ this.render();
+ }
+ },
+ postCreate: function(){
+ this.render();
+ dojo.connect(this.button, "onClick", this, "keyUp");
+ },
+ debug: function(e, verb, fruit){
+ console.debug("You " + verb + " a:", fruit);
+ },
+ // Note, the load tag here is superfluous, since _HtmlTemplate has a dojo.require for it.
+ templateString: '<!--{% load dojox.dtl.contrib.dijit %}--><div><input dojoAttachEvent="onkeyup: keyUp" dojoAttachPoint="input"> <button dojoType="dijit.form.Button" dojoAttachPoint="button">Add/Remove Item</button><ul><!--{% for item in items %}--><li onclick="debug \'ate\' item"><!--{{ item }}--></li><!--{% endfor %}--></ul></div>'
+ });
+
+ dojo.require("dojo.parser");
+ </script>
+ <body class="tundra">
+ <div dojoType="Fruit"></div>
+ </body>
+ </head>
+</html> \ No newline at end of file