Labels: HTTP Io AR: Java SP file on Art
Original article: Creating template-based Widgets
In this tutorial, you will learn the importance of dijit's _ templatedmixin mixing into classes and How to Use templates to quickly create your own custom pendants.
Start
If you are not familiar with how to create dijit pendants, you may need to take a look at the _ widgets tutorial. Creating custom pendants tutorials and compiling your own pendants tutorials also help you learn how to create pendants.
Dijit's _ widgetbase provides excellent infrastructure for the creation of pendants, but the _ templatedmixin mixing class is where dijit shines. By using _ templatedmixin and _ widgetsintemplatemixin, you can quickly create maintained and modified pendants.
_ The basic concept of templatedmixin is very simple: it allows developers to create a small extension HTML file, load it at runtime, and provide it to the pendant instance for use.
Let's take a look at what _ templatedmixin defines (and why), and how to build a simple pendant using its functions.
Note _ templatemixin is intended to be used as a hybrid class and is not directly used for inheritance. In the class-based syntax, it is more like an interface (although the interfaces and classes in Javascript cannot be clearly divided ). For how classes work in Dojo, see the dojo declaration tutorial.
_ What does templatedmixin provide?
_ Templatedmixin provides a templatestring attribute for the pendant. It looks very simple. Why is it so powerful? The answer lies in what else templatemixin adds to your hanger.
Tip: The templatepath still exists, but it is not used to load the template. It is still there for backward compatibility. Later we will see how to use dojo/text! To load the template of the pendant.
-[Dojo tutorials] creating template-based Widgets