Skip to main content

Dojo Getting Started


Dojo Modules

Dojo Core:- This contains core dojo files.

Dijit :- This contains modules used for UI widgets.

Dojox :- Contains unstable modules there be included in DIJIT or dojo.

Util : Contains modules for ducumentaiton, Style or testing.


Where to find all our questions :- 

One site I recommend for learning dojo is https://dojotoolkit.org/.


Where can I get list of demo of dojo and view its source:-


demos.dojotoolkit.org/demos/
For example for creation of form you can visit:-

http://demos.dojotoolkit.org/demos/form/demo.html

here you will get all demos which can apply to your application.

To see all the widgets you can use in your application or website using dojo

demos.dojotoolkit.org/demos/themePreviewer/demo.html

  • How to load dojo in an HTML page 
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Tutorial: Hello Dojo!</title>
</head>
<body>
    <h1 id="greeting">Hello</h1>
    <!-- load Dojo -->
    <script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js"
            data-dojo-config="async: true"></script>

</body>
</html>



  • How to Load another dojo script in your dojo class.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Tutorial: Hello Dojo!</title>
</head>
<body>
    <h1 id="greeting">Hello</h1>
    <!-- load Dojo -->
    <script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js"
            data-dojo-config="async: true"></script>
    <script>
        require([
            'dojo/dom',
            'dojo/dom-construct'
        ], function (dom, domConstruct) {
            var greetingNode = dom.byId('greeting');
            domConstruct.place('<em> Dojo!</em>', greetingNode);
        });
    </script>
</body>
</html>


here require method is used to load require dojo classes. 


  • Writing dojo in an HTML page
dojo.addOnLoad(function() {    dojo.create(        "div",        {
          "innerHTML": "Hello, World!"        },        dojo.body()    ); });


This syntax will write hello world in dojo.

here we are using dojo.create function to load div <> in html using dojo.


Some useful dojo functions


1. dojo.byId The dojo.byId function lets you select a DOM node by its id attribute. 

 dojo.byId("message").innerHTML; 

This is a DIV element with id attribute message1.


2. dojo.fadeOut

dojo.fadeOut({    node: dojo.byId("message"),    duration: 600 }).play()

This will cause message to disapper to reappear use fadeIn

3. dojo.query

dojo.query("#list li").forEach(function(item) {    console.log(item.innerHTML); });

used to query or work on more than one element.

Using dojo.query to work on attribute using classname 


dojo.query(".title").style({    backgroundColor: "yellow",    color: "red" });


4. dojo.forEach

For Looping on each element 

var list = ['My','name','is','Joe']; dojo.forEach(list, function(item, i) {    console.log((i+1)+'. '+item); });


5. The dojo.indexOf function lets you find what position in an array a particular value is at.

dojo.indexOf(list, "name"); 1

Creating Classes

The dojo/_base/declare module is the foundation of class creation within the Dojo Toolkit. declare allows for multiple inheritance to allow developers to create flexible code and avoid writing the same code routines. Dojo, Dijit, and Dojox modules all use declare; in this tutorial, you'll learn why you should too.


ClassName

The className argument represents the name of the class, including the namespace, to be created. Named classes are placed within the global scope. The className can also represent the inheritance chain via the namespace.
Named Class
// Create a new class named "mynamespace.MyClass"
declare("MyClass", null, {
    // Custom properties and methods here
});
A class named mynamespace.MyClass is now globally available within the application.

Commonly used functions of dojo


  • Mouseout
  • Keypress
  • Keyup
  • blur
  • change
  • focus
  • click
  • mouseover
  • submit.

DojoConfig

The dojoConfig object  is the primary mechanism for configuring Dojo in a web page or application.

dojoConfig is a simple object stores the array of arrays with key value pairs.

 dojo-config attribute




   <script type="text/javascript"
            src="http://ajax.googleapis.com/ajax/libs/dojo/1.9/dojo/dojo.js"
    data-dojo-config="parseOnLoad: true, isDebug: true"></script>

Dojo Config Object

<script type="text/javascript">
       var dojoConfig = {
            parseOnLoad: true,
            isDebug: true,
        };
</script>



The attribute djConfig="parseOnLoad: true" tells Dojo to search the HTML on your page for any Dojo widgets you may have added. For this to work, we need to include the Dojo parser. This is accomplished by adding some JavaScript code to our page.



Importing CSS in Dojo



<style type="text/css">
  @import "http://maximo.com/dojo/1.1.0/dojo/resources/dojo.css";
  @import
    "http://maximo.com/dojo/1.1.0/dijit/themes/tundra/tundra.css";
</style>













Comments

Popular posts from this blog

Maximo Interview Questions - Maximo Technical and Functional Questions

Technical Questions How do you rate your self in :- 1. PL/SQL 2. Java 3. Automation Script 4. Mbo Customization 5. Admininstration Jobs 6. Funtional Concepts 7. Maximo Configuration Do not rate anything less than 7 unless you don't want interview to skip the topic Deployment / Administration  1. Explain LDAP integration? 2. Explain SSO and LTPA token? 3. What is global security? 4. How session is managed in Websphere or Maximo? 16. How to insert attributes from Backend? 5. How request is passed in Maximo? 6. How to do horizontal and vertical clustering? 7. Explain how you confire websphere for maximo manually? 8. What are Websphere MQ? 9. What is JMS, Connection Factory and Queues? 10. What is difference between vmm and ldap sync integration ? 11. What is Standalone and federated repository? 12. How to install a new language in Maximo? 13. What are the steps to apply a Fix pack in Maximo, Websphere or DB2? 14. Have you worked on any performance checking tools? 15

Maximo Bean Class Methods

Methods of Bean Classes of Maximo Reset Method   This method is called when a new filter is applied for the dialog's MboSet.  @see psdi.webclient.system.beans.DataBean#reset()     @Override     public void reset() throws MXException     {             try         {                 saveCurrentSelection();         }         catch (RemoteException e)         {             handleRemoteException(e);         }         super.reset();     } Initialize It is used to initialize values on a dialog @Override     protected void initialize() throws MXException, RemoteException     {         uids = new ArrayList<Long>();         super.initialize();     } Call Method This method is called whenever an event is generated in the dialog (e.g. OK button is pressed). It is      overridden to merge all previously saved selections and reset the resulting MboSet accordingly.      *@see psdi.webclie