Home arrow JavaScript arrow Using the EXT JS Date Picker Widget
JAVASCRIPT

Using the EXT JS Date Picker Widget


In a recent article I looked at the EXT JS JavaScript library and gave a brief overview of what it does and what it contains. In this article we’re going to look at implementing one of the many widgets that come with the library – the date picker widget.

Author Info:
By: Dan Wellman
Rating: 5 stars5 stars5 stars5 stars5 stars / 17
July 14, 2008
TABLE OF CONTENTS:
  1. · Using the EXT JS Date Picker Widget
  2. · Invoking the Date Picker
  3. · Finishing the Example
  4. · Finishing continued

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Using the EXT JS Date Picker Widget
(Page 1 of 4 )

Getting Started

You’ll need a copy of the library of course; to get it you can go to the EXT JS site at http://extjs.com and visit the downloads page. Once downloaded, create a directory in which to store the library and the example page that we’ll be creating; c:extjs-site should suffice. Next create another new directory within this called ext and unpack the library to this folder. Now that the library is installed we can begin coding. In a new file in your text editor, create the following basic page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>

<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>EXT JS Datepicker Example</title>

</head>

<body>

<label>Enter a date: </label><input type="text" id="dateField"><button id="openCalendar">Open Calendar</button><div id="calendar"></div>

<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>

<script type="text/javascript" src="ext/ext-all.js"></script>

</body>

</html>


Aside from the standard page furniture common to any basic web page (doctype declaration, content type declaration, etc), we have three files from the library. The first is the CSS file responsible for styling the widgets in EXT JS; next is the base file for the library (ext-base.js) which sets up the namespacing, the internal cache and provides other core services; finally, there is a file that encompasses all of utilities and widgets within the library. Using this file means that we don’t need to worry about which other components the DatePicker class needs in order to function correctly.

The body of the page contains a simple text box, which is where the date that is chosen using the date picker will be placed; a button that will be used to open the date picker (we could use the button widget from the library, but we’ll stick with the standard HTML equivalent for this example); and an empty container element for the date picker to be rendered into.


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 2 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials