Login Register

Creating and Scripting Widgets

Part 2: Dijit discussed how to work with widgets declaratively, using the "dojoType" attribute in HTML tags. This section explains how to create and interact with dojo widgets programmatically, via JavaScript.

This discussion spans the following topics:

Creating a Widget Programmatically
How to create dojo widgets from JavaScript, and swap/insert them into a page's DOM existing structure
Interacting With Widgets
How to change properties/behavior of a dojo widget throughout the lifecycle of a page
Writing Your Own Widget
How to write and instantiate your own widgets

Examples Needed

We need examples that show us how to use the data-enabled controls programatically. We also need info on the properties and methods we can use for each control.

These are elsewhere...

The properties and methods for each control are in Part 2. And though all of the examples are declarative, they can all be converted to programmatic examples with a simple code change.

Mis-organization.

There is no reason for a reader to think that "creating a widget programatically" should be inside "Manipulating widgets". Creating a new widget is not manipulating a widget. I had a hard time finding the "create a widget" page because it was hidden under a seemingly unrelated title.

Makes Sense

... so I changed the title.

This comment and reply will be removed after 12/31/07 to avoid confusion.