Class YAHOO.ext.grid.DateEditor
Provides a date editor field, and optionally a DatePicker. The DateEditor provides a method to override (showCalendar) if you don't want to use the built in DatePicker control. The reason I chose to use my own DatePicker control rather than the nice YUI Calendar component is my control was very easy to override events to make it work well with the grid. It's also only 5k compressed, while the YUI Calendar is 40k compressed. The DatePicker supports left/right keys to move months, up/down keys to move years and the mouse wheel to quickly go through the months. The DateEditor supports the following configuration options:
- format - The date format for the editor. The format is identical to PHP date() and text is allowed. Credit for that goes to this fantastic date library. This format is for the editor only and doesn't affect the rendering of the cell when not in edit mode. Your rendering function can use any date format it wants.
- minValue - The minimum allowed date. Can be either a Javascript date object or a string date in the specified format.
- maxValue - The maximum allowed date. Can be either a Javascript date object or a string date in the specified format.
- minText - The tooltip to display when the date in the cell is before minValue.
- maxText - The tooltip to display when the date in the cell is after maxValue.
- invalidText - The text to display when the date in the field is invalid (for example: 02/31/06)
- disabledDays - An array of days to disable, 0 based. For example, [0, 6] disables Sunday and Saturday.
- disabledDaysText - The tooltip to display when the date in the cell (or DatePicker) falls on a disabled day.
- disabledDates - An array of "dates" to disable, as strings. These strings will be used to build a dynamic regular expression so they are very powerful. For example, ["03/08/2003", "09/16/2003"] would disable those dates, but ["03/08", "09/16"] would disable them for every year. If you are using short years, you will want to use ^ to tell the regular expression to only match the beginning like ["^03/08"]. To disable March of 2006: ["03/../2006"] or every March ["^03"]. In order to support regular expressions, if you are using a date format that has "." in it, you will have to escape the dot when restricting dates. For example: ["03\\.08\\.03"].
- disabledDatesText - The tooltip to display when the date in the cell (or DatePicker) falls on a disabled date.
- allowBlank - True if the cell is allowed to be empty.
- blankText - The tooltip (error message) to display when the cell is empty and is not allowed to be.
- validator - Any custom validation function you want called. The function must return true if the data is valid or an error message otherwise.
- validationDelay - The delay in milliseconds for validation. Each time the user types something the field is validated after a specified delay, setting this value allows you to customize that delay (for example, if your custom validation routine is slow).
For more information on using this editor, see
this blog post.
Public Properties
This class has no public properties.
Public Methods
|
DateEditor(Object config ) |
DateEditor |
Create a new DateEditor |
Public Events
This class has no public events.
Constructor Details
DateEditor
public function DateEditor(Object config
)
yui-ext - Copyright © 2006 Jack Slocum. |
Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.