JavaScript
  Home arrow JavaScript arrow Page 4 - Rich Internet Applications with Dojo Toolk...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Rich Internet Applications with Dojo Toolkit 101
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 11
    2007-01-17

    Table of Contents:
  • Rich Internet Applications with Dojo Toolkit 101
  • Displaying a simple button
  • Adding an event and styling
  • The DatePicker and Accordion widgets
  • How do the widgets look in various browsers?

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Rich Internet Applications with Dojo Toolkit 101 - The DatePicker and Accordion widgets


    (Page 4 of 5 )

    The Date Picker

    One of the strengths of the dojo UI is its support for elements not in the HTML DTD, like DatePicker, Tree, Accordion and so on. You can see how easy it is to provide a DatePicker as shown in the next code.

    <HTML> 
    <HEAD> 
    <TITLE>Widgets </TITLE> 
    <script type="text/javascript">
    var djConfig = {isDebug: true};
    </script>
    <SCRIPT type="text/javascript" 
    src="http://images.devshed.com/da/stories/
    http://localhost/DoAjax/dojo.js"
    > </script> <script type="text/javascript">dojo.require("dojo.widget.*");</script> </SCRIPT> </HEAD> <BODY> <div dojoType="datepicker" widgetId="x"></div> </BODY> </HTML>

    With just this reference you will get a nice looking DatePicker object in your page as shown. You could also easily interact with the DatePicker. 

    The Accordion widget

    The Accordion widget may consist of several content panes which can be selectively displayed by clicking on the desired pane. In version 0.4, the AccordionContainer will contain the panes. The individual panes may be independently styled as shown in the listing. It so happens that the AccordionContainer.js file is in a different location and hence there is an extra src reference (in red).

    <HTML> 
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <head>
    <title>Accordion Pane Demo</title> 
    <script type="text/javascript">
    var djConfig = {isDebug: true };
    </script>
    <script type="text/javascript" src="http://images.devshed.com/da/stories/
    http://localhost/DoAjax/dojo.js"></script>
    <script type="text/javascript"  
    src="http://images.devshed.com/da/stories/
    http://localhost/DOAjax/src/widget/AccordionContainer.js"></script>
    <script type="text/javascript"> dojo.require("dojo.widget.*"); dojo.require("dojo.widget.AccordionContainer"); </script> </head> <BODY> <!-- div container for accordion--> <div dojoType="AccordionContainer"
    style="float: left; margin-right: 30px; width: 400px; height: 300px; overflow: scroll;"> <!-- the content panes--> <div dojoType="ContentPane"
    label="Htek" selected="true" ; style="color:green; overflow: scroll;
    background-color:yellow;"> A thing of beauty is a joy for ever </div>

    <div dojoType="ContentPane" label="Hodentek" selected="true" style="color:red;overflow: scroll;
    background-color:#FFFF80;"> <a href="http://hodentek.blogspot.com">My Blog</a> <br/> </div>
    <div dojoType="ContentPane" label="ASPFree"
    selected="true" style="color:blue;overflow: scroll;
    background-color:#FF8040;"> A thing of beauty is a joy for ever</div> ... </div>
    </BODY> </HTML>

    The next two pictures show the opened panes as seen on the browser. No event was necessary to get to the panes. If you just click on the labels the panes move apart.

     

    Of course the content panes are containers too, and you could place other widgets in them as shown in the following code.

    <HTML> 
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <head>
    <title>Accordion Pane Demo</title> 
    <script type="text/javascript">
    var djConfig = {isDebug: true };
    </script>
    <script type="text/javascript" src="http://images.devshed.com/da/stories/
    http://localhost/DoAjax/dojo.js"></script>
    <script type="text/javascript" src="http://images.devshed.com/da/stories/
    http://localhost/DOAjax/src/widget/AccordionContainer.js"></script>
    <script type="text/javascript"> dojo.require("dojo.widget.*"); dojo.require("dojo.widget.AccordionContainer"); </script> <script type="text/javascript"> function showup(){ alert ("Hello, from button a inside an accordion"); } </script> </head> <BODY> <!-- div container for accordion--> <div dojoType="AccordionContainer" style="float: left;
    margin-right: 30px; width: 400px; height: 300px; overflow: scroll;"> <div dojoType="ContentPane" label="Htek"
    selected="true" ; style="color:green;overflow: scroll;
    background-color:yellow;"> A thing of beauty is a joy for ever <br/>
    <button dojoType="Button" widgetId="dojo Welcome"
    onClick=showup>Hi Dojo!</button>
    </div> <div dojoType="ContentPane" label="Hodentek"
    selected="true" style="color:red;overflow: scroll;
    background-color:#FFFF80;"> <a href="http://hodentek.blogspot.com">
    <div dojoType="datepicker" widgetId="foo"> </div> <p></p>My Blog</a> <br/> </div> <div dojoType="ContentPane" label="ASPFree"
    selected="true" style="color:blue;overflow: scroll;
    background-color:#FF8040;"> A thing of beauty is a joy for ever</div> ... </div> </BODY> </HTML>

    More JavaScript Articles
    More By Jayaram Krishnaswamy


       · This is my first article and many more will follow. Before I could post the initial...
     

    JAVASCRIPT ARTICLES

    - Using Mod_Security to Protect Your Server
    - Detecting and Countering Server Intrusions
    - Securing Your Web Server
    - Building a Secure Web Server
    - Protecting the Server
    - Book Review: Learning the Yahoo! User Interf...
    - Dynamically Generate a Selection List in a R...
    - Intergrate DWR into Your Java Web Application
    - Detect Browser Compatibility with the Reques...
    - Using the EXT JS Date Picker Widget
    - Ajax Hack for Entering Information Without R...
    - EXT JS 2.1 Overview
    - Using the Style Object for Zebra Tables with...
    - Binary Searching
    - An Improved Approach to Building Zebra Tables






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT