Class TDatePicker
Direct Known Sub-classes:
TDatePicker class.
TDatePicker displays a text box for date input purpose. When the text box receives focus, a calendar will pop up and users can pick up from it a date that will be automatically entered into the text box. The format of the date string displayed in the text box is determined by the DateFormat property. Valid formats are the combination of the following tokens, - Character Format Pattern (en-US)
- -----------------------------------------
- d day digit
- dd padded day digit e.g. 01, 02
- M month digit
- MM padded month digit
- MMMM localized month name, e.g. March, April
- yy 2 digit year
- yyyy 4 digit year
- -----------------------------------------
TDatePicker has three Mode to show the date picker popup. - Basic -- Only shows a text input, focusing on the input shows the
date picker.
- Button -- Shows a button next to the text input, clicking on the
button shows the date, button text can be by the
ButtonText property
- ImageButton -- Shows an image next to the text input, clicking on
the image shows the date picker, image source can be
change through the ButtonImageUrl property.
The CssClass property can be used to override the css class name for the date picker panel. CalendarStyle property sets the packages styles available. E.g. default. The InputMode property can be set to "TextBox" or "DropDownList" with default as "TextBox". In <tt>DropDownList</tt> mode, in addition to the popup date picker, three drop down list (day, month and year) are presented to select the date . The PositionMode property can be set to "Top" or "Bottom" with default as "Bottom". It specifies the position of the calendar popup, relative to the input field.
| Constants Inherited From TControl |
|
AUTOMATIC_ID_PREFIX,
CLIENT_ID_SEPARATOR,
CS_CHILD_INITIALIZED,
CS_CONSTRUCTED,
CS_INITIALIZED,
CS_LOADED,
CS_PRERENDERED,
CS_STATE_LOADED,
ID_FORMAT,
ID_SEPARATOR,
IS_CHILD_CREATED,
IS_CREATING_CHILD,
IS_DISABLE_THEMING,
IS_DISABLE_VIEWSTATE,
IS_ID_SET,
IS_SKIN_APPLIED,
IS_STYLESHEET_APPLIED,
RF_ADAPTER,
RF_AUTO_BINDINGS,
RF_CHILD_STATE,
RF_CONTROLS,
RF_CONTROLSTATE,
RF_DATA_BINDINGS,
RF_EVENTS,
RF_NAMED_CONTROLS,
RF_NAMED_CONTROLS_ID,
RF_NAMED_OBJECTS,
RF_SKIN_ID,
|
| Method Summary |
|
protected
void
|
Add the client id to the input textbox, and register the client scripts.
|
|
protected
TDatePickerClientScript
|
|
|
protected
string
|
|
|
string
|
|
|
string
|
|
|
string
|
|
|
TDatePickerClientScript
|
Gets the TDatePickerClientScript to set the TDatePicker event handlers.
|
|
protected
array
|
Get javascript localization options, e.g. month and weekday names.
|
|
string
|
Gets the current culture.
|
|
protected
string
|
|
|
integer
|
Returns the timestamp selected by the user.
|
|
string
|
|
|
string
|
|
|
protected
array
|
Loads date from drop down list data.
|
|
protected
string
|
Gets the ID for the date picker trigger button.
|
|
protected
array
|
Get javascript date picker options.
|
|
protected
array
|
|
|
integer
|
|
|
integer
|
|
|
TDatePickerInputMode
|
|
|
protected
DateTimeFormatInfo
|
|
|
protected
array
|
Returns the localized month names that depends on the month format pattern.
|
|
TDatePickerMode
|
|
|
TDatePickerPositionMode
|
|
|
boolean
|
|
|
integer
|
|
|
protected
integer
|
Gets the date from the text input using TSimpleDateFormatter
|
|
integer
|
|
|
integer
|
Returns the value to be validated.
|
|
protected
void
|
|
|
boolean
|
Loads user input data. Override parent implementation, when InputMode is DropDownList call getDateFromPostData to get date data.
|
|
void
|
Publish the date picker Css asset files.
|
|
protected
string
|
Publish the calendar style Css asset file.
|
|
protected
void
|
Registers the javascript code to initialize the date picker.
|
|
void
|
Renders body content.
|
|
protected
THtmlWriter
|
Adds an additional button such that when clicked it shows the date picker.
|
|
protected
void
|
Renders the day drop down list options.
|
|
protected
void
|
Renders the month drop down list options.
|
|
protected
void
|
Renders the calendar drop down list depending on the DateFormat pattern.
|
|
protected
void
|
Renders the year drop down list options.
|
|
protected
void
|
Renders the date picker popup buttons.
|
|
protected
void
|
Renders the drop down list date picker.
|
|
protected
THtmlWriter
|
Adds an additional image button such that when clicked it shows the date picker.
|
|
void
|
AutoPostBack is not supported.
|
|
void
|
|
|
void
|
|
|
void
|
|
|
void
|
Sets the culture/language for the date picker.
|
|
void
|
Sets the timestamp represented by this control.
|
|
void
|
|
|
void
|
Sets the format of the date string.
|
|
void
|
Set the first day of week, with 0 as Sunday, 1 as Monday, etc.
|
|
void
|
|
|
void
|
|
|
void
|
|
|
void
|
|
|
void
|
Sets whether to pop up the calendar window when the control receives focus
|
|
void
|
Sets the date for the date picker using timestamp.
|
|
void
|
|
| Methods Inherited From TTextBox |
|
TTextBox::addAttributesToRender(), TTextBox::getAutoCompleteType(), TTextBox::getAutoPostBack(), TTextBox::getAutoTrim(), TTextBox::getCausesValidation(), TTextBox::getClientClassName(), TTextBox::getColumns(), TTextBox::getData(), TTextBox::getDataChanged(), TTextBox::getEnableClientScript(), TTextBox::getIsValid(), TTextBox::getMaxLength(), TTextBox::getPersistPassword(), TTextBox::getPostBackOptions(), TTextBox::getReadOnly(), TTextBox::getRows(), TTextBox::getSafeText(), TTextBox::getSafeTextParser(), TTextBox::getTagName(), TTextBox::getText(), TTextBox::getTextMode(), TTextBox::getValidationGroup(), TTextBox::getValidationPropertyValue(), TTextBox::getWrap(), TTextBox::loadPostData(), TTextBox::onTextChanged(), TTextBox::raisePostDataChangedEvent(), TTextBox::renderClientControlScript(), TTextBox::renderContents(), TTextBox::setAutoCompleteType(), TTextBox::setAutoPostBack(), TTextBox::setAutoTrim(), TTextBox::setCausesValidation(), TTextBox::setColumns(), TTextBox::setData(), TTextBox::setEnableClientScript(), TTextBox::setIsValid(), TTextBox::setMaxLength(), TTextBox::setPersistPassword(), TTextBox::setReadOnly(), TTextBox::setRows(), TTextBox::setText(), TTextBox::setTextMode(), TTextBox::setValidationGroup(), TTextBox::setWrap()
|
| Methods Inherited From TWebControl |
|
TWebControl::addAttributesToRender(), TWebControl::clearStyle(), TWebControl::copyBaseAttributes(), TWebControl::createStyle(), TWebControl::getAccessKey(), TWebControl::getBackColor(), TWebControl::getBorderColor(), TWebControl::getBorderStyle(), TWebControl::getBorderWidth(), TWebControl::getCssClass(), TWebControl::getDisplay(), TWebControl::getFont(), TWebControl::getForeColor(), TWebControl::getHasStyle(), TWebControl::getHeight(), TWebControl::getStyle(), TWebControl::getTabIndex(), TWebControl::getTagName(), TWebControl::getToolTip(), TWebControl::getWidth(), TWebControl::render(), TWebControl::renderBeginTag(), TWebControl::renderContents(), TWebControl::renderEndTag(), TWebControl::setAccessKey(), TWebControl::setBackColor(), TWebControl::setBorderColor(), TWebControl::setBorderStyle(), TWebControl::setBorderWidth(), TWebControl::setCssClass(), TWebControl::setDisplay(), TWebControl::setForeColor(), TWebControl::setHeight(), TWebControl::setStyle(), TWebControl::setTabIndex(), TWebControl::setToolTip(), TWebControl::setWidth()
|
| Methods Inherited From TControl |
|
TControl::addedControl(), TControl::addParsedObject(), TControl::addToPostDataLoader(), TControl::applyStyleSheetSkin(), TControl::autoBindProperty(), TControl::autoDataBindProperties(), TControl::bindProperty(), TControl::broadcastEvent(), TControl::bubbleEvent(), TControl::clearChildState(), TControl::clearControlState(), TControl::clearNamingContainer(), TControl::clearViewState(), TControl::convertUniqueIdToClientId(), TControl::createChildControls(), TControl::createControlCollection(), TControl::dataBind(), TControl::dataBindChildren(), TControl::dataBindProperties(), TControl::ensureChildControls(), TControl::findControl(), TControl::findControlsByID(), TControl::findControlsByType(), TControl::focus(), TControl::getAdapter(), TControl::getAllowChildControls(), TControl::getAttribute(), TControl::getAttributes(), TControl::getChildControlsCreated(), TControl::getClientID(), TControl::getControls(), TControl::getControlStage(), TControl::getControlState(), TControl::getCustomData(), TControl::getEnabled(), TControl::getEnableTheming(), TControl::getEnableViewState(), TControl::getHasAdapter(), TControl::getHasAttributes(), TControl::getHasChildInitialized(), TControl::getHasControls(), TControl::getHasInitialized(), TControl::getHasLoaded(), TControl::getHasLoadedPostData(), TControl::getHasPreRendered(), TControl::getID(), TControl::getNamingContainer(), TControl::getPage(), TControl::getParent(), TControl::getRegisteredObject(), TControl::getSkinID(), TControl::getSourceTemplateControl(), TControl::getTemplateControl(), TControl::getUniqueID(), TControl::getViewState(), TControl::getVisible(), TControl::hasAttribute(), TControl::initRecursive(), TControl::isDescendentOf(), TControl::isObjectRegistered(), TControl::loadRecursive(), TControl::loadState(), TControl::loadStateRecursive(), TControl::onDataBinding(), TControl::onInit(), TControl::onLoad(), TControl::onPreRender(), TControl::onUnload(), TControl::preRenderRecursive(), TControl::raiseBubbleEvent(), TControl::registerObject(), TControl::removeAttribute(), TControl::removedControl(), TControl::render(), TControl::renderChildren(), TControl::renderControl(), TControl::saveState(), TControl::saveStateRecursive(), TControl::setAdapter(), TControl::setAttribute(), TControl::setChildControlsCreated(), TControl::setControlStage(), TControl::setControlState(), TControl::setCustomData(), TControl::setEnabled(), TControl::setEnableTheming(), TControl::setEnableViewState(), TControl::setID(), TControl::setPage(), TControl::setSkinID(), TControl::setTemplateControl(), TControl::setViewState(), TControl::setVisible(), TControl::trackViewState(), TControl::traverseChildControls(), TControl::unbindProperty(), TControl::unloadRecursive(), TControl::unregisterObject(), TControl::__get()
|
| Methods Inherited From TComponent |
|
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()
|
| Constant Summary |
| string
|
SCRIPT_PATH |
Script path relative to the TClientScriptManager::SCRIPT_PATH
|
| Method Details |
addAttributesToRender
| protected void addAttributesToRender |
(THtmlWriter $writer ) |
Add the client id to the input textbox, and register the client scripts.
|
createClientScript
|
getAssetUrl
| protected string getAssetUrl |
(string $file ) |
| Input |
| string | $file | date picker asset file in the self::SCRIPT_PATH directory. |
| Output |
|
string
| date picker asset url. |
| Exception |
|
getButtonImageUrl
| public string getButtonImageUrl |
() |
| Output |
|
string
| the image url for "Image" UI mode. |
| Exception |
|
getButtonText
| public string getButtonText |
() |
| Output |
|
string
| text for the date picker button. Default is "...". |
| Exception |
|
getCalendarStyle
| public string getCalendarStyle |
() |
| Output |
|
string
| current calendar style |
| Exception |
|
getClientSide
Gets the TDatePickerClientScript to set the TDatePicker event handlers.
The date picker on the client-side supports the following events. - <tt>OnDateChanged</tt> -- raised when the date is changed.
You can attach custom javascript code to each of these events
|
getCulturalOptions
| protected array getCulturalOptions |
() |
Get javascript localization options, e.g. month and weekday names.
| Output |
|
array
| localization options. |
| Exception |
|
getCulture
| public string getCulture |
() |
Gets the current culture.
| Output |
|
string
| current culture, e.g. en_AU. |
| Exception |
|
getCurrentCulture
| protected string getCurrentCulture |
() |
| Output |
|
string
| the current culture, falls back to application if culture is not set. |
| Exception |
|
getData
| public integer getData |
() |
Returns the timestamp selected by the user.
This method is required by IDataRenderer. It is the same as getTimeStamp().
| Output |
|
integer
| the timestamp of the TDatePicker control. |
| Exception |
|
getDate
| Output |
|
string
| the date string. |
| Exception |
|
getDateFormat
| public string getDateFormat |
() |
| Output |
|
string
| the format of the date string |
| Exception |
|
getDateFromPostData
| protected array getDateFromPostData |
(string $key , array $values ) |
Loads date from drop down list data.
| Input |
| string | $key | the key that can be used to retrieve data from the input data collection |
| array | $values | the input data collection |
| Output |
|
array
| the date selected |
| Exception |
|
getDatePickerButtonID
| protected string getDatePickerButtonID |
() |
Gets the ID for the date picker trigger button.
| Output |
|
string
| unique button ID |
| Exception |
|
getDatePickerOptions
| protected array getDatePickerOptions |
() |
Get javascript date picker options.
| Output |
|
array
| date picker client-side options |
| Exception |
|
getDropDownDayOptions
| protected array getDropDownDayOptions |
() |
| Output |
|
array
| list of day options for a drop down list. |
| Exception |
|
getFirstDayOfWeek
| public integer getFirstDayOfWeek |
() |
| Output |
|
integer
| first day of the week |
| Exception |
|
getFromYear
| public integer getFromYear |
() |
| Output |
|
integer
| date picker starting year, default is -5 years |
| Exception |
|
getInputMode
| Output |
|
TDatePickerInputMode
| input method of date values. Defaults to TDatePickerInputMode::TextBox. |
| Exception |
|
getLocalizedCalendarInfo
| protected DateTimeFormatInfo getLocalizedCalendarInfo |
() |
| Output |
|
DateTimeFormatInfo
| date time format information for the current culture. |
| Exception |
|
getLocalizedMonthNames
| protected array getLocalizedMonthNames |
(DateTimeFormatInfo $info ) |
Returns the localized month names that depends on the month format pattern.
"MMMM" will return the month names, "MM" or "MMM" return abbr. month names and "M" return month digits.
| Input |
| DateTimeFormatInfo | $info | localized date format information. |
| Output |
|
array
| localized month names. |
| Exception |
|
getMode
|
getPositionMode
|
getShowCalendar
| public boolean getShowCalendar |
() |
| Output |
|
boolean
| whether the calendar window should pop up when the control receives focus |
| Exception |
|
getTimeStamp
| public integer getTimeStamp |
() |
| Output |
|
integer
| current selected date from the date picker as timestamp, NULL if timestamp is not set previously. |
| Exception |
|
getTimeStampFromText
| protected integer getTimeStampFromText |
() |
Gets the date from the text input using TSimpleDateFormatter
| Output |
|
integer
| current selected date timestamp |
| Exception |
|
getUpToYear
| public integer getUpToYear |
() |
| Output |
|
integer
| date picker ending year, default +10 years |
| Exception |
|
getValidationPropertyValue
| public integer getValidationPropertyValue |
() |
Returns the value to be validated.
This methid is required by IValidatable interface.
| Output |
|
integer
| the interger timestamp if valid, otherwise the original text. |
| Exception |
|
hasDayPattern
| protected void hasDayPattern |
() |
|
loadPostData
| public boolean loadPostData |
(string $key , array $values ) |
Loads user input data. Override parent implementation, when InputMode is DropDownList call getDateFromPostData to get date data.
This method is primarly used by framework developers.
| Input |
| string | $key | the key that can be used to retrieve data from the input data collection |
| array | $values | the input data collection |
| Output |
|
boolean
| whether the data of the component has been changed |
| Exception |
|
onPreRender
| public void onPreRender |
(mixed $param ) |
Publish the date picker Css asset files.
| Input |
| mixed | $param | |
| Output |
| Exception |
|
publishCalendarStyle
| protected string publishCalendarStyle |
() |
Publish the calendar style Css asset file.
| Output |
|
string
| Css file url. |
| Exception |
|
registerCalendarClientScript
| protected void registerCalendarClientScript |
() |
Registers the javascript code to initialize the date picker.
|
render
Renders body content.
This method overrides parent implementation by adding additional date picker button if Mode is Button or ImageButton.
|
renderButtonDatePicker
| protected THtmlWriter renderButtonDatePicker |
(mixed $writer ) |
Adds an additional button such that when clicked it shows the date picker.
|
renderCalendarDayOptions
| protected void renderCalendarDayOptions |
(THtmlWriter $writer , mixed $selected ) |
Renders the day drop down list options.
| Input |
| THtmlWriter | $writer | the writer used for the rendering purpose |
| mixed | $selected | selected day. |
| Output |
| Exception |
|
renderCalendarMonthOptions
| protected void renderCalendarMonthOptions |
(THtmlWriter $writer , mixed $selected ) |
Renders the month drop down list options.
| Input |
| THtmlWriter | $writer | the writer used for the rendering purpose |
| mixed | $selected | selected month. |
| Output |
| Exception |
|
renderCalendarSelections
| protected void renderCalendarSelections |
(THtmlWriter $writer , array $date ) |
Renders the calendar drop down list depending on the DateFormat pattern.
| Input |
| THtmlWriter | $writer | the Html writer to render the drop down lists. |
| array | $date | the current selected date |
| Output |
| Exception |
|
renderCalendarYearOptions
| protected void renderCalendarYearOptions |
(THtmlWriter $writer , mixed $selected ) |
Renders the year drop down list options.
| Input |
| THtmlWriter | $writer | the writer used for the rendering purpose |
| mixed | $selected | selected year. |
| Output |
| Exception |
|
renderDatePickerButtons
| protected void renderDatePickerButtons |
(mixed $writer ) |
Renders the date picker popup buttons.
| Input |
| mixed | $writer | |
| Output |
| Exception |
|
renderDropDownListCalendar
| protected void renderDropDownListCalendar |
(mixed $writer ) |
Renders the drop down list date picker.
| Input |
| mixed | $writer | |
| Output |
| Exception |
|
renderImageButtonDatePicker
| protected THtmlWriter renderImageButtonDatePicker |
(mixed $writer ) |
Adds an additional image button such that when clicked it shows the date picker.
|
setAutoPostBack
| public void setAutoPostBack |
(mixed $value ) |
AutoPostBack is not supported.
| Input |
| mixed | $value | |
| Output |
| Exception |
|
setButtonImageUrl
| public void setButtonImageUrl |
(string $value ) |
| Input |
| string | $value | the image url for "Image" UI mode. |
| Output |
| Exception |
|
setButtonText
| public void setButtonText |
(string $value ) |
| Input |
| string | $value | text for the date picker button |
| Output |
| Exception |
|
setCalendarStyle
| public void setCalendarStyle |
(string $value ) |
| Input |
| string | $value | set the calendar style |
| Output |
| Exception |
|
setCulture
| public void setCulture |
(string $value ) |
Sets the culture/language for the date picker.
| Input |
| string | $value | a culture string, e.g. en_AU. |
| Output |
| Exception |
|
setData
| public void setData |
(integer $value ) |
Sets the timestamp represented by this control.
This method is required by IDataRenderer. It is the same as setTimeStamp().
| Input |
| integer | $value | the timestamp of the TDatePicker control. |
| Output |
| Exception |
|
setDate
| public void setDate |
(string $value ) |
| Input |
| string | $value | date string |
| Output |
| Exception |
|
setDateFormat
| public void setDateFormat |
(string $value ) |
Sets the format of the date string.
| Input |
| string | $value | the format of the date string |
| Output |
| Exception |
|
setFirstDayOfWeek
| public void setFirstDayOfWeek |
(integer $value ) |
Set the first day of week, with 0 as Sunday, 1 as Monday, etc.
| Input |
| integer | $value | 0 for Sunday, 1 for Monday, 2 for Tuesday, etc. |
| Output |
| Exception |
|
setFromYear
| public void setFromYear |
(integer $value ) |
| Input |
| integer | $value | date picker starting year, default is 2000. |
| Output |
| Exception |
|
setInputMode
|
setMode
|
setPositionMode
|
setShowCalendar
| public void setShowCalendar |
(boolean $value ) |
Sets whether to pop up the calendar window when the control receives focus
| Input |
| boolean | $value | whether to show the calendar window |
| Output |
| Exception |
|
setTimeStamp
| public void setTimeStamp |
(float $value ) |
Sets the date for the date picker using timestamp.
| Input |
| float | $value | time stamp for the date picker |
| Output |
| Exception |
|
setUpToYear
| public void setUpToYear |
(integer $value ) |
| Input |
| integer | $value | date picker ending year, default +10 years |
| Output |
| Exception |
|
| Constant Details |
SCRIPT_PATH
Script path relative to the TClientScriptManager::SCRIPT_PATH
Type:
string
Value:
'prado/datepicker'
|
|