To learn about the ArcGIS Server JavaScript API, ESRI uses the JavaScript open-source framework Dojo in this API. So I first learned some Dojo knowledge, so I will be ready for future work.
In fact, there are many open-source JavaScript frameworks, such as prototype, jQuery, Yui of Yahoo, and ExtJS. We do not have to guess why ESRI uses Dojo, some people are sure to learn the truth. Learning Dojo well is the truth.
Before learning Dojo, you must have some necessary knowledge about J avaScript, such as json. In the past, JavaScript thought it was okay, and ExtJS was an entry. It is much easier to learn Dojo.
Now the latest version of Dojo is 1.5.0, on its official website can be downloaded to the dojo-release-1.5.0.zip compressed file.
Let's get down to the truth. Here are some of my learning points. You should take a personal note.
Copy codeThe Code is as follows:
1. Use dojo. require to load the required parts in a way similar to # include or Java import in C programming.
For example, dojo. require ("dojo. parser"); dojo. require ("dijit. form. Button ");
2. Cross-origin custom Module
Dojo configuration, djConfig = "baseUrl :'./'"
Path of the registration module, dojo. registerModulePath ("dtdg", "./dtdg ");
Load the custom module, dojo. require ("dtdg. foo ");
3. Local toolbox Module
Directly load the custom module, dojo. require ("dtdg. foo ");
4. register events for objects
Dojo. connect ();
5. Conversion between json and string
Dojo. fromJson (/* String */json); // return JavaScript Object, json object
Dojo. toJson (/* Object */json,/* Boolean */prettyPrint); // return a string
6. Ajax Communication
Dojo. xhrGet (/* Object */args); dojo. xhrPost (/* Object */args );
Dojo. xhr (/* String */method,/* Object */args,/* Boolean? */HasBody );
7. Localization
DjConfig = "dojo. local: 'zh '"
8. Controls and la s are all in dijit.