Button Variations
Dijit provides drop-in, degradable replacements for standard
push buttons and checkboxes, yet it also gives you a lot of
sophisticated options, such as the kinds of buttons that you normally
find in toolbars. Let's start out with an ordinary Button and work our way up through more
sophisticated options.
Button
Figure 13-4 shows a button, and Table 13-12 gives the rundown on the most basic
kind of button dijit, a Button,
which inherits _FormWidget.
Figure 13-4. A typical Button
Table 13-12. Button properties
Name | Comment |
|---|---|
| Used to provide the label for the button in markup or via programmatic creation. |
| A Boolean value
designating whether to display the text label in the
|
| A class specifying an image that can make a button appear like an icon. |
| An extension point that is called in response to a click. This is a very common method to override. |
| A method accepting an
HTML string that can change a |
Tip
Unlike TextBox and its
descendants, the Button widgets
require you to use the setAttribute('value', /*...*/) function,
inherited from _FormWidget, to
set value because Buttons don't have a widget
value so much as they have a form value that is relayed
to the server.
Let's dust off the code from Example 13-4 and provide some final polish by replacing those ugly buttons, as ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access