Month: May 2010

Learning Dojo — 5. Remote Scripting (AJAX)

1. Remote Scripting is not just AJAX . There are 3 ways.    a.XHR(AJAX) -> Same-Origin Limited    b.iframe    -> Same-Orignin Limited; It can post a file.    c.Loading a script element ->  Not limited to Same-Origin Policy 2. XHR with dojo      a. Example dojo.xhrGet({ url: "demo/id2", handleAs: "json", handle: handler4 });      b. …

Learning Dojo — 5. Remote Scripting (AJAX) Read More »

Learning Dojo — 4. DOM APIs

1. Select Node API   a.dojo.byId()   b.dojo.query("div.question p")       i.The parameter here should apply to CSS3 Selector      ii.This function always returns a NodeList, even if there is only one node selected 2. Attributes Operation    dojo.attr(), dojo.hasAttr(), dojo.removeAttr() … 3. CSS Operation   dojo.style(), dojo.hasClass(), …. 4. Insert/Remove Nodes    dojo.place(newNode, parentNode, "last");… …

Learning Dojo — 4. DOM APIs Read More »

Learning Dojo — 3.3 Asynchronous Programming

1. Handling dom events   a.Define the event handler function alertSomeEvent(){ alert("someEvent"); }   b.Connect some event to the handler function connect(){ dojo.connect(dojo.byId("someButton"),"click", alertSomeEvent); }   c.Register this connection when dom tree initialization is done          dojo.addOnLoad(connect); 2. Handling user-defined events    It’s similar with handling dom events, only that the events here user-defined functions …

Learning Dojo — 3.3 Asynchronous Programming Read More »

Learning Dojo — 3.2 OO APIs

1. dojo.hitch:  Takes a function as the parameter and execute it var alerter = { doAlert: function(){ alert("something"); } } dojo.hitch(alerter, doAlert); 2. Array methods: dojo.forEach(), dojo.every(), and so on 3. Type methods: dojo.isString(), dojo.isArray()… 4. Object Coping: dojo.mixin(), dojo.clone()…

Learning Dojo — 3.1 Core features of the Dojo language

1. Module(Package) name <==> the javascript file’s  path/filename 2. A module is always DEFINED in a single file, althought its implemenation can go into several files 3. The "dojo" module has to be loaded before any other modules, and it’s not loaded by "dojo.require", but by the script tag     <script type="text/javascript" src="xxx/dojo/dojo.js"/> 4. You …

Learning Dojo — 3.1 Core features of the Dojo language Read More »

Learning Dojo — 2. A quick tour

1. Three steps for installing Dojo <style type="text/css"> @import "/dojoroot/dijit/themes/tundra/tundra.css"; @import "/dojoroot/dojo/resources/dojo.css"; </style> <script type="text/javascript" src="/dojoroot/dojo/dojo.js" djConfig="parseOnLoad: true,isDebug:true"></script> <body class="tundra">… <script> dojo.require("dojo.parser"); <!– similar with "import java.util.List" –> </script> 2. Some userful Controls you may want to try    TabContainer, ContentPane, ValidationTextBox 3. Ajax    a. Features — Cross-Browser Compatibility and prvoiding easy-to-use APIs on …

Learning Dojo — 2. A quick tour Read More »

Learning Dojo — 1. Introduction

Notes for reading ‘ Mastering Dojo‘ =========================================== 1. We’ve had wonderful technologies for server-side development, and now it is the turn of the client-side. 2.Dojo is such a framework, which will dismantle the gap between browser-based applications and desktop applications. 3.Features of Dojo   a. Fix browser defects, such as browser compatibility problems and memory …

Learning Dojo — 1. Introduction Read More »