Class \Prado\Web\UI\WebControls\TDatePicker
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 four Mode to show the date picker popup.
Basic -- Only shows a text input, focusing on the input shows the
date picker. This way you can access the popup using only
the keyboard. Note that because of this, TAB-bing through
this control will automatically select the current date if
no previous date was selected. If you close the popup (eg.
pressing the ESC key) you'll need to un-focus and re-focus
the control again for the popup to reappear.
Clickable -- Only shows a text input, clicking on the input shows the
date picker. This mode solves the two small problems of the
Basic mode. It was first introduced in Prado 3.2.
Button -- Shows a button next to the text input, clicking on the
button shows the date, button text can be by the
<b>ButtonText</b> 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 <b>ButtonImageUrl</b> 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 DropDownList 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.
Class hierarchy
- \Prado\Web\UI\WebControls\TDatePicker
- \Prado\Web\UI\WebControls\TTextBox implements IPostBackDataHandler, IValidatable, IDataRenderer
- \Prado\Web\UI\WebControls\TWebControl implements IStyleable
- \Prado\Web\UI\TControl implements IRenderable, IBindable
- \Prado\TApplicationComponent
- \Prado\TComponent
Author: Carl G. Mathisen <carlgmathisen@gmail.com>
Since: 3.0
public
|
|
public
|
|
public
|
|
public
|
getClientSide() : TDatePickerClientScript
Gets the TDatePickerClientScript to set the TDatePicker event handlers.
The date picker on the client-side supports the following events. OnDateChanged -- raised when the date is changed.You can attach custom javascript code to each of these events |
public
|
|
public
|
getData() : int
Returns the timestamp selected by the user.
This method is required by IDataRenderer. It is the same as getTimeStamp(). |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
getValidationPropertyValue() : int|string
Returns the value to be validated.
This method is required by \Prado\Web\UI\IValidatable interface. |
public
|
loadPostData(string $key, array<string|int, mixed> $values) : bool
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. |
public
|
|
public
|
render(THtmlWriter $writer) : mixed
Renders body content.
This method overrides parent implementation by adding additional date picker button if Mode is Button or ImageButton. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
setData(int $value) : mixed
Sets the timestamp represented by this control.
This method is required by IDataRenderer. It is the same as setTimeStamp(). |
public
|
|
public
|
|
public
|
setFirstDayOfWeek(int $value) : mixed
Set the first day of week, with 0 as Sunday, 1 as Monday, etc.
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
setShowCalendar(bool $value) : mixed
Sets whether to pop up the calendar window when the control receives focus
|
public
|
|
public
|
|
protected
|
addAttributesToRender(THtmlWriter $writer) : mixed
Add the client id to the input textbox, and register the client scripts.
|
protected
|
|
protected
|
|
protected
|
getCulturalOptions() : array<string|int, mixed>
Get javascript localization options, e.g. month and weekday names.
|
protected
|
|
protected
|
getDateFromPostData(string $key, array<string|int, mixed> $values) : string
Loads date from drop down list data.
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
getLocalizedMonthNames(CultureInfo $info) : array<string|int, mixed>
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. |
protected
|
|
protected
|
|
protected
|
|
protected
|
registerCalendarClientScriptPre() : mixed
Registers the javascript code to initialize the date picker.
|
protected
|
renderButtonDatePicker(THtmlWriter $writer) : mixed
Adds an additional button such that when clicked it shows the date picker.
|
protected
|
renderCalendarDayOptions(THtmlWriter $writer[, null|mixed $selected = null ]) : mixed
Renders the day drop down list options.
|
protected
|
renderCalendarMonthOptions(THtmlWriter $writer[, null|mixed $selected = null ]) : mixed
Renders the month drop down list options.
|
protected
|
renderCalendarSelections(THtmlWriter $writer, DateTime $date) : mixed
Renders the calendar drop down list depending on the DateFormat pattern.
|
protected
|
renderCalendarYearOptions(THtmlWriter $writer[, null|mixed $selected = null ]) : mixed
Renders the year drop down list options.
|
protected
|
|
protected
|
|
protected
|
|
protected
|
renderImageButtonDatePicker(THtmlWriter $writer) : mixed
Adds an additional image button such that when clicked it shows the date picker.
|
private
|
renderDropDownListOptions(THtmlWriter $writer, array<string|int, mixed> $options[, null|mixed $selected = null ]) : mixed
Renders a drop down lists.
|
public
mixed
|
SCRIPT_PATH
Script path relative to the TClientScriptManager::SCRIPT_PATH
|
'datepicker'
|