-[Dojo tutorials] creating template-based Widgets

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.