>All Tutorials 
Ajax and .NET Ajax and .NET RSS XML
Ajax and ColdFusion Ajax and ColdFusion RSS XML
Ajax and Java Ajax and Java RSS XML
Ajax and PHP Ajax and PHP RSS XML
Ajax and SOA Ajax and SOA RSS XML
Ajax Goodies Ajax Goodies RSS XML
Ajax Tool Ajax Tool RSS XML
Facebook MockAjax Facebook MockAjax RSS XML
Google Web Toolkit Google Web Toolkit RSS XML
JavaScript Framework JavaScript Framework RSS XML
Ruby on Rails Ruby on Rails RSS XML
Technique Introduction Technique Introduction RSS XML
Without XMLHttpRequest Without XMLHttpRequest RSS XML
Yahoo! UI Yahoo! UI RSS XML

Dojo: A Slideshow Widget Example - dojo widget code img dom template div slideshow

 
Registered tutorials: 501
Registered Users: 33126



Rating: 3.5 out of 4 votes cast


  
Category: JavaScript Framework

Dojo: A Slideshow Widget Example

Digg this   Post to del.icio.us

Abstract: This article demonstrate you how to build the slide-show widget. There's not a ton of code to it, but we'll start with the smallest possible (loads but doesn't do anything) version of the widget

If you like, you can stop here and go add a slideshow to your pages. But odds are you want to build a widget yourself. This article will show you how you can do that and use Dojo to go from idea to upgrade-able interface. Fast.

Intro

A key feature of the Dojo widget system is the ability to prototype, test, and tweak the component's UI and interactions. Dojo provides "templates" that you can use to rapidly prototype your UI in HTML and CSS and expose your widgets as markup on the pages you include them on. Dojo ensures that your work in prototyping isn't thrown away when it comes time for deployment. Incremental performance optimizations to be discussed in another article ensure that your widget is as fast as you need it to be.

Prototype

Templates in Dojo place HTML and CSS fragments into files which are consulted when a widget is constructed. The setup of event handlers and the creation of references to DOM nodes is handled through some extra attributes on your HTML markup.

In this article, we're going to show you how we built the slide-show widget you see above. There's not a ton of code to it, but we'll start with the smallest possible (loads but doesn't do anything) version of the widget. Here it is:

// tell the package system what classes get defined here
dojo.provide("dojo.widget.SlideShow");

// load dependencies
dojo.require("dojo.widget.*");

// define the widget class
dojo.widget.SlideShow = function(){
    // inheritance
    // see: http://www.cs.rit.edu/~atk/JavaScript/manuals/jsobj/
    dojo.widget.HtmlWidget.call(this);

    this.templatePath = dojo.uri.dojoUri("src/widget/templates/HtmlSlideShow.html");
    this.templateCSSPath = dojo.uri.dojoUri("src/widget/templates/HtmlSlideShow.css");

    this.widgetType = "SlideShow";
}
// complete the inheritance process
dj_inherits(dojo.widget.SlideShow, dojo.widget.HtmlWidget);
// make it a tag
dojo.widget.tags.addParseTreeHandler("dojo:slideshow");

Most things in this class are boilerplate, and only those properties that are necessary are given values. Every Dojo widget you'll create comes from a class constructor like this one.


Read Full Tutorial...



Reviews:

Rate and Review This Site

No reviews yet


Statistic Information About this Resource:


Total Hits: 2253
Unique Hits: 1867


  Daily Weekly Monthly
  Unique Total Unique Total Unique Total
Average 3.3 4.4 15.1 18.1 69.3 85.8
Current 3 6 3 6 3 6
Previous 4 5 28 35 101 120
Nov 29 2 2 18 20 93 111
Nov 28 8 9 0 0 77 95
Nov 27 4 7 18 20 75 105
Nov 26 4 4 0 0 79 99
Nov 25 4 6 30 38 96 120
Nov 24 0 0 0 0 0 0
Nov 23 2 2 27 29 92 116
Nov 22 2 3 27 33 77 86
Highest 13 16 39 47 118 158


Script Execution Time: 0.58765 | SQL Queries: 10 | Members: 501
Ajax Tutorial Top List - Powered by Aardvark Topsites PHP 5.1.2