Dropping and Adding Items
The checkltemAcceptance method relies on some housekeeping operations performed as items are dropped it expects the box weight to be correct and the allRMASerials list to be up-to-date. These go into Tree's onDndDrop extension point. The chain of events on a drop goes like this 1. The user lets go of the mouse. 2. checkAcceptance and checkltemAcceptance are called. If they both return true, the drop proceeds. 3. Tree updates the display and the data store. 4. Lastly, Tree calls the onDndDrop...
ItemFileReadStore and Trees
An ItemFileReadStore can nest JSON hashes within JSON hashes, a technique we saw in Section 3.2, Literals and Hashes, on page 39.2 That structure translates directly to a tree a nested hash will display as a folder node that you can expand. 2. This kind of nesting is called native nesting. ItemFileReadStore also supports reference nesting, allowing more complex relationships such as assigning multiple parents to a child. These relationships cannot be modeled with a Tree anyway, but if you're...
Executing RPCs with dojorpc
Dojo's RPC machinery takes an SMD description and produces an object that can be used to make remote procedure calls. Here's an example SMD description for a service that publishes the functions add and subtract Download Line 1 var arithmeticService serviceURL demo id7, - parameters 15 name opl, Assuming the server at demo id7 accepts requests and delivers responses in JSON, the function dojo.rpc.JsonService will take this description 11. and return an object that can be used to make the...
Constraints and Formatting
Although you could validate numbers, times, and dates with a Vali-dationTextBox and regular expressions, Dijit provides specialized subclasses of ValidationTextBox that are much easier. Rather than specifying a regular expression, these controls use constraints that are specialized and easier to read. The constraint is used both to format a standard form number or date into a readable, localized form and to parse it from a localized form back to standard form. There are two forms of constraints...
XHR Callbacks
Now, back to the business at hand. We have most of the properties ready for dojo.io.script.get except for the two meatiest ones load and error. These two properties are callbacks functions that run after an asynchronous event completes. What do those functions look like Here's the rest of our dojo.io.script.get call Download Function runs when Yahoo returns with the answer load function searchResult Zero out the current list listNode dojo.byId resultUl listNode.innerHTML function result var...
Key Aspects of Dojo
Let's survey the broad landscape that is Dojo. Not Just a Library A Toolkit Dojo is a collection of static, client-side JavaScript scripts. There is no client-side plug-in or server-side components. It includes the following A design and implementation that normalizes the browser, allowing the same source code to work in several browsers no more browser feature sniffing and resulting browser-dependent code . Functions libraries that abstract the sometimes-obtuse, arcane, and inconvenient W3C...




