-
Book Overview & Buying
-
Table Of Contents
Google Web Toolkit 2 Application Development Cookbook
By :
A calendar widget and a text field combined into the DateField widget allows to input date-type data. This calendar widget has more control of the date ranges. We can disable all the dates before a particular date, disable future dates, and so on. Keyboard navigation is also supported. In this recipe, we are going to create a DateField instance for the date of birth of a person.
Import the class com.extjs.gxt.ui.client.widget.form.DateField.
Create an instance of the DateField class as shown:
DateField dateOfBirthField = new DateField();
Set the minimum and maximum allowable date:
dateOfBirthField.setMinValue(new Date(80,1,1)); dateOfBirthField.setMaxValue(new Date());
Add the DateField instance to any form, panel, or relevant widget.
In this recipe, the minimum and maximum dates are set respectively as January 1, 1980 and the current date. Any date before the minimum and after the maximum is not allowed to be selected.
Change the font size
Change margin width
Change background colour