When building a select control in a form there are times where its available options need to change dynamically in response to a change in another control. For instance, a form with both country and state/province select controls might require the options in the state select to change based on the country select’s current selection. This is what we would call a dependent, or linked, select. One way to accomplish this is by watching changes in the selection state of one select and finding and setting the appropriate selection values on the other.
The selection values of Dijit Select widgets can be provided as an array of
options objects or a dojo/store instance. We will walk through an example creating a dependent select for both types of source data.
dgrid 0.3.16 has been released! It includes the following improvements:
- Various improvements to keyboard accessibility, including interoperation with the ColumnSet mixin and editor column plugin
- Additional ARIA attributes for improved accessibility in the ColumnHider and Pagination extensions
- Improvements to logic for drag-and-drop operations with DnD extension
More information on dgrid 0.3.16 is available in the release notes.
We are working hard on our next release, dgrid 0.4!
While TypeScript is very simple to understand when performing basic tasks, having a deeper understanding of how its type system works is critical to unlocking advanced language functionality. Once we know more about how TypeScript really works, we can leverage this knowledge to write cleaner, well-organised code.
If you find yourself having trouble with some of the concepts discussed in this article, try reading through the Definitive Guide to TypeScript first to make sure you’ve got a solid understanding of all the basics.
SitePen is a rather unique company. For those of you who don’t already know, everyone in our company works from home. We are all spread across the United States. Despite that, the magic of our culture is that we feel closer to our coworkers at SitePen than at our previous office-based jobs. How is that even possible?!? We have grown together (think Katamari Damacy) through phone and online conversations and the virtual office we share is a very real thing for us. However, as a result, most of us haven’t seen each other’s faces before. Unplugged was a treat for everyone as it gave us a week to indulge in the opposite end of the social spectrum. No electronic devices, only face to face interactions and (gasp! frightening, I know) eye contact! Hey seriously, stop looking at the floor… I’m up here!
Leading up to the Unplugged event itself, nobody knew exactly what we were getting ourselves into. We only knew that we signed a few scary waivers, there would be rafting, no electronic devices, and that our flights were taking us all to Colorado on the same day. Suspense and intrigue leading into a new, shared adventure!
Bootstrap is a framework created by Twitter’s developers to consolidate their HTML/CSS design and widgets. Bootstrap provides a clean responsive design, but the set of widgets it includes is limited, especially when compared to what’s available in the Dijit library. The CSS/HTML theme can be used independently of the widgets, but how do you use the Bootstrap theme with the Dijit library?
As you may have guessed, it’s not quite as simple as including the relevant Bootstrap CSS files. However, Dijit supports custom themes, so with a bit of work the elements of the Bootstrap theme could be ported to Dijit widgets. Fortunately, this was just what the dbootstrap project set out to accomplish.
For a better idea of what this Dijit/Bootstrap marriage looks like, check out the dbootstrap gallery, a modified version of Dijit’s Theme Tester that also includes dgrid. Let’s take a closer look at dbootstrap and how to use it in your Dojo application.
When developing for the web, it is a recommended best practice to always test your application during development with a web server. This is for two primary reasons. By running a web server, you can approximate a production environment similar to how your application will be served to your users. Also, browsers implement a same-origin policy that is different for quasi-protocols like
file://. Many of Dojo’s modules like
dojo/text, Dijit templates, and
dojox/gfx depend on loading files from the same origin.
A common practice when adding new elements to a document is to add them to a container DIV and then insert that node into into a document. A lesser used alternative is the
DocumentFragment class. So, what is a document fragment, and when should you use one instead of a container DIV?
- Using when(value) to always create a promise
- Passing callbacks to be applied directly to the value
When writing tests for an application, it’s prudent to add mock or stub data in order to allow code to be properly tested in isolation from other parts of the system. Within a normal Dojo application, there are typically three places where mocking will occur: I/O requests, stores, and module dependencies.
Many of the best practices for writing testable code also conform to general code best practices. Code that is easily testable often also tends to be highly maintainable and resilient against changing business requirements. This blog post provides a brief overview of key criteria for writing highly testable code.