Dojo Learning Notes 2. Djconfig Commentary

Source: Internet
Author: User
Tags array

Djconfig is a global set object built by dojo that can control the behavior of Dojo

First we need to declare the Djconfig object before referencing the dojo.js so that we can get the values we set when we load Dojo.js, although the dojo support after the 0.3 version is set after loading, it is strongly recommended that you declare the Djconfig code as the first script

A complete Djconfig object is defined as follows (values are the default values of Dojo)

<script type="text/javascript">
var djConfig = {
  isDebug: false,
  debugContainerId: "",
  bindEncoding: "",
  allowQueryConfig: false,
  baseScriptUri: "",
  parseWidgets: true
  searchIds: [],
  baseRelativePath: "",
  libraryScriptUri: "",
  iePreventClobber: false,
  ieClobberMinimal: true,
  preventBackButtonFix: true,
};
</script>

Isdebug is a very useful property, as the name suggests, if set to true, then all dojo. Debug output is valid, should be set to true at development time, should be set to False when published

Debugcontainerid is also related to debugging, if not specified, debugging information will be directly used document.write output, which may damage the overall layout of the page, so you can specify any ID of the HTML element that can be used as the container as the Debugging information output container

Allowqueryconfig, this property indicates whether dojo allows the related properties in Djconfig to be read from the parameters of the page URL, and when the value is true, Dojo will first read the other properties of djconfig from the URL parameter, such as: http:// Server/dojodemo.htm?djconfig.debugcontainerid=divdebug

Basescripturi, generally do not need to set, Dojo will automatically according to the path you reference dojo.js set this value, for example, <script type= "Text/javascript" src=. /dojo/dojo.js "></script>, the automatically obtained value is ... /dojo/

PS: If you have multiple projects that need to quote dojo.js at the same time, it is recommended that dojo be used as an independent project, using the absolute path when quoting.

Parsewidgets, this is to control whether dojo automatically resolves HTML elements with Dojotype as the corresponding widget, and if you don't use any widgets, it's recommended to set false to speed up dojo loading

Searchids, this is an array of strings that defines the IDs of all HTML elements that need to be resolved to the widget, and if the HTML element that is not in the ID is not parsed, then all elements with Dojotype will be parsed when the array is an empty array

There is also a bindencoding that is used to set the encoding for the default bind request

As for the other attributes, it's not very useful, just not knowing what it does.

In the actual development, you can put the definition of djconfig in a JS file, and as the first reference JS file, this should be the most convenient.

Related Article

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.