Monday, June 18, 2007

An introduction to Dojo

Related link:

What is dojo?
Dojo is an Open Source DHTML toolkit that is written in JavaScript. For more information, take a look at this:

Quick intro to general function in Dojo:
  1. dojo.require(String module)
    This is how to include other module file to work with.
  2. dojo.byId(String id)
    This sounds like document.getElementById(String id) in standard Javascript.
  3. dojo.addOnLoad(Function func)
    This function will be executed after all the HTML is already loaded.
  4. dojo.connect
    This is the way to map an event handler (function) to any property or element or object.
    function sayHello() {
    alert("Hello, everyone.");

    function init() {
    dojo.connect(dojo.byId('helloButton'), 'onclick', 'sayHello');
  5. dojo.declare
    This is all you need when you want to create new widget.
    - Name of widget
    - Extended widget
    - Constructor
    - Variables and functions
    [dijit.base.FormElement, dijit.base.TemplatedWidget],
    required: false,

    templateString: "",

    onclick: function() {
We can hook any parameters or functions before rendering HTML page here before manager render this page.
If you want to hook any parameters or functions after the manager rendered HTML page, do it here.

No comments: