A concept that is often confusing to new JavaScript developers is the idea of function context, specifically as it relates to the value of this. For example, methods in Java are bound to classes at compile time, and this in a method call will always refer to an instance of the method’s class.
One pretty common issue we get in the dojo-interest mailing list asks why RoundRectStoreList.set(“store”, store); doesn’t actually appear to be setting the store properly? That is, the data in the RoundRectStoreList doesn’t actually render the data in the new store, but instead keeps old data rendered. An example of this error: HTML: [code language=”html”] Swap ‘Em! [/code] JavaScript: [code language=”javascript”] require([ “dojo/store/Memory”, “dijit/form/Button”, “dojox/mobile/RoundRectStoreList” ], function (Memory, Button, RoundRectStoreList) { var sampleStore1 = new Memory({data:[ { “label”: “Wi-Fi”, “rightText”: “Off”, “moveTo”: “bar” }, { “label”: “VPN”, “rightText”: “VPN”, “moveTo”: “bar” } ], idProperty:”label”}), sampleStore2 = new Memory({data:[ { “label”: “Ice Cream”, “rightText”: “Ice Cream”, “moveTo”: “bar” }, { “label”: “Shortcake”, “rightText”: “Shortcake”, “moveTo”: “bar” } ], idProperty:”label”}), storeList = new RoundRectStoreList({store:sampleStore1}, “storeList”), wrongSwap = new Button({}, “wrongSwap”), isStore1 = true; storeList.startup(); wrongSwap.on(“click”, function () { storeList.set(“store”, isStore1 ? sampleStore2 : sampleStore1); isStore1 = !isStore1; }); }); [/code] Here, you will see that the data in the list never actually changes, even though we’re attempting to set the store using the .set() function.
In this post, we want to walk through how you would get started building an application using xstyle, an extensible CSS framework. xstyle provides extensions that allows us to declaratively describe an user interface, making use of data bindings, element generation, and components, giving us an elegant means to create an application.
As dgrid’s adoption continues to rise, one of the most common questions developers ask is how to add filtering controls. Unlike some grid implementations, dgrid does not include an out-of-the-box component implementing a user interface for filtering.
In addition to a simple, consistent, cross-browser interface to DOM events, dojo/on provides for very convenient clean-up – the function returns a handle with a remove method that will un-register the event listener. Clean-up concerns are not limited to DOM events, so Dojo provides the same interface for dojo/aspect and dojo/topic.
Dojo provides many settings to configure the optimal loading and building of your application source code. We are often asked about the differences between packages, paths, and aliases.
We answer many, many, many questions on a daily basis through our Dojo training workshops, JavaScript support plans and during our customers’ development projects. We have bucket-loads of answered questions.
As part of our great updates to the Dojo Tutorials for Dojo 1.8, we’ve been busy creating several new tutorials. Dojo 1.7+ now uses the popular has() pattern for feature detection in combination with a has()-aware build system.
When developing a JavaScript framework that others will consume, it’s hugely beneficial to provide clean, organized API documentation to accompany your codebase. With the August release of Dojo 1.8, we saw a brand new, extensible documentation parser, which is used to generate output for Dojo’s API viewer.
Receive Our Latest Insights!
Sign up to receive our latest articles on JavaScript, TypeScript, and all things software development!