|
Class TDatePicker
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 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 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 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.
-
TComponent
-
TApplicationComponent
-
TControl
implements
IRenderable,
IBindable
-
TWebControl
implements
IStyleable
-
TTextBox
implements
IPostBackDataHandler,
IValidatable,
IDataRenderer
-
TDatePicker
Methods summary
public
|
#
setAutoPostBack( boolean $value )
AutoPostBack is not supported.
AutoPostBack is not supported.
Parameters
- $value
boolean the value indicating if postback automatically
Overrides
|
public
string
|
#
getDateFormat( )
Returns
string the format of the date string
|
public
|
#
setDateFormat( string $value )
Sets the format of the date string.
Sets the format of the date string.
Parameters
- $value
string the format of the date string
|
public
boolean
|
#
getShowCalendar( )
Returns
boolean whether the calendar window should pop up when the control receives focus
|
public
|
#
setShowCalendar( boolean $value )
Sets whether to pop up the calendar window when the control receives
focus
Sets whether to pop up the calendar window when the control receives
focus
Parameters
- $value
boolean whether to show the calendar window
|
public
string
|
#
getCulture( )
Gets the current culture.
Gets the current culture.
Returns
string current culture, e.g. en_AU.
|
public
|
#
setCulture( string $value )
Sets the culture/language for the date picker.
Sets the culture/language for the date picker.
Parameters
- $value
string a culture string, e.g. en_AU.
|
public
|
|
public
TDatePickerInputMode
|
|
public
|
|
public
TDatePickerMode
|
|
public
|
#
setButtonImageUrl( string $value )
Parameters
- $value
string the image url for "Image" UI mode.
|
public
string
|
#
getButtonImageUrl( )
Returns
string the image url for "Image" UI mode.
|
public
|
#
setCalendarStyle( string $value )
Parameters
- $value
string set the calendar style
|
public
string
|
#
getCalendarStyle( )
Returns
string current calendar style
|
public
|
#
setFirstDayOfWeek( integer $value )
Set the first day of week, with 0 as Sunday, 1 as Monday, etc.
Set the first day of week, with 0 as Sunday, 1 as Monday, etc.
Parameters
- $value
integer 0 for Sunday, 1 for Monday, 2 for Tuesday, etc.
|
public
integer
|
#
getFirstDayOfWeek( )
Returns
integer first day of the week
|
public
string
|
#
getButtonText( )
Returns
string text for the date picker button. Default is "...".
|
public
|
#
setButtonText( string $value )
Parameters
- $value
string text for the date picker button
|
public
|
#
setFromYear( integer $value )
Parameters
- $value
integer date picker starting year, default is 2000.
|
public
integer
|
#
getFromYear( )
Returns
integer date picker starting year, default is -5 years
|
public
|
#
setUpToYear( integer $value )
Parameters
- $value
integer date picker ending year, default +10 years
|
public
integer
|
#
getUpToYear( )
Returns
integer date picker ending year, default +10 years
|
public
|
|
public
TDatePickerPositionMode
|
|
public
integer
|
#
getTimeStamp( )
Returns
integer current selected date from the date picker as timestamp, NULL if timestamp is
not set previously.
|
public
|
#
setTimeStamp( float $value )
Sets the date for the date picker using timestamp.
Sets the date for the date picker using timestamp.
Parameters
- $value
float time stamp for the date picker
|
public
integer
|
#
getData( )
Returns the timestamp selected by the user. This method is required by IDataRenderer . It is the same as TDatePicker::getTimeStamp() .
Returns
integer the timestamp of the TDatePicker control.
Since
3.1.2
See
Overrides
|
public
|
#
setData( integer $value )
Sets the timestamp represented by this control. This method is required by
IDataRenderer . It is the same as TDatePicker::setTimeStamp() .
Parameters
- $value
integer the timestamp of the TDatePicker control.
Since
3.1.2
See
Overrides
|
public
string
|
#
getDate( )
Returns
string the date string.
|
public
|
#
setDate( string $value )
|
public
TDatePickerClientScript
|
#
getClientSide( )
Gets the TDatePickerClientScript to set the TDatePicker event handlers.
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
Returns
|
protected
TDatePickerClientScript
|
|
public
integer
|
#
getValidationPropertyValue( )
Returns the value to be validated. This methid is required by IValidatable
interface.
Returns the value to be validated. This methid is required by IValidatable
interface.
Returns
integer the interger timestamp if valid, otherwise the original text.
Overrides
|
public
|
#
onPreRender( TEventParameter $param )
Publish the date picker Css asset files.
Publish the date picker Css asset files.
Parameters
Overrides
|
public
|
#
render( THtmlWriter $writer )
Renders body content. This method overrides parent implementation by adding
additional date picker button if Mode is Button or ImageButton.
Renders body content. This method overrides parent implementation by adding
additional date picker button if Mode is Button or ImageButton.
Parameters
Overrides
|
protected
|
#
renderDatePickerButtons( mixed $writer )
Renders the date picker popup buttons.
Renders the date picker popup buttons.
|
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.
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.
Parameters
- $key
string the key that can be used to retrieve data from the input data collection
- $values
array the input data collection
Returns
boolean whether the data of the component has been changed
Overrides
|
protected
array
|
#
getDateFromPostData( string $key, array $values )
Loads date from drop down list data.
Loads date from drop down list data.
Parameters
- $key
string the key that can be used to retrieve data from the input data collection
- $values
array the input data collection
Returns
array the date selected
|
protected
array
|
#
getDatePickerOptions( )
Get javascript date picker options.
Get javascript date picker options.
Returns
array date picker client-side options
|
protected
array
|
#
getCulturalOptions( )
Get javascript localization options, e.g. month and weekday names.
Get javascript localization options, e.g. month and weekday names.
Returns
array localization options.
|
protected
string
|
#
getCurrentCulture( )
Returns
string the current culture, falls back to application if culture is not set.
|
protected
DateTimeFormatInfo
|
#
getLocalizedCalendarInfo( )
Returns
DateTimeFormatInfo date time format information for the current culture.
|
protected
|
#
renderDropDownListCalendar( mixed $writer )
Renders the drop down list date picker.
Renders the drop down list date picker.
|
protected
|
|
protected
|
#
renderCalendarSelections( THtmlWriter $writer, array $date )
Renders the calendar drop down list depending on the DateFormat pattern.
Renders the calendar drop down list depending on the DateFormat pattern.
Parameters
- $writer
THtmlWriter
the Html writer to render the drop down lists.
- $date
array the current selected date
|
protected
integer
|
#
getTimeStampFromText( )
Gets the date from the text input using TSimpleDateFormatter
Gets the date from the text input using TSimpleDateFormatter
Returns
integer current selected date timestamp
|
protected
|
#
renderCalendarDayOptions( THtmlWriter $writer, mixed $selected = null )
Renders the day drop down list options.
Renders the day drop down list options.
Parameters
- $writer
THtmlWriter
the writer used for the rendering purpose
- $selected
mixed selected day.
|
protected
array
|
#
getDropDownDayOptions( )
Returns
array list of day options for a drop down list.
|
protected
|
#
renderCalendarMonthOptions( THtmlWriter $writer, mixed $selected = null )
Renders the month drop down list options.
Renders the month drop down list options.
Parameters
- $writer
THtmlWriter
the writer used for the rendering purpose
- $selected
mixed selected month.
|
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.
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.
Parameters
- $info
DateTimeFormatInfo localized date format information.
Returns
array localized month names.
|
protected
|
#
renderCalendarYearOptions( THtmlWriter $writer, mixed $selected = null )
Renders the year drop down list options.
Renders the year drop down list options.
Parameters
- $writer
THtmlWriter
the writer used for the rendering purpose
- $selected
mixed selected year.
|
protected
string
|
#
getDatePickerButtonID( )
Gets the ID for the date picker trigger button.
Gets the ID for the date picker trigger button.
Returns
string unique button ID
|
protected
THtmlWriter
|
#
renderButtonDatePicker( mixed $writer )
Adds an additional button such that when clicked it shows the date
picker.
Adds an additional button such that when clicked it shows the date
picker.
Returns
|
protected
THtmlWriter
|
#
renderImageButtonDatePicker( mixed $writer )
Adds an additional image button such that when clicked it shows the date
picker.
Adds an additional image button such that when clicked it shows the date
picker.
Returns
|
protected
string
|
#
getAssetUrl( string $file = '' )
Parameters
- $file
string date picker asset file in the self::SCRIPT_PATH directory.
Returns
string date picker asset url.
|
protected
string
|
#
publishCalendarStyle( )
Publish the calendar style Css asset file.
Publish the calendar style Css asset file.
Returns
string Css file url.
|
protected
|
#
addAttributesToRender( THtmlWriter $writer )
Add the client id to the input textbox, and register the client scripts.
Add the client id to the input textbox, and register the client scripts.
Parameters
Overrides
|
protected
|
#
registerCalendarClientScriptPre( )
Registers the javascript code to initialize the date picker.
Registers the javascript code to initialize the date picker.
|
protected
|
#
renderClientControlScript( mixed $writer )
Renders the javascript for textbox.
Renders the javascript for textbox.
Overrides
|
Methods inherited from TTextBox
getAutoCompleteType(),
getAutoPostBack(),
getAutoTrim(),
getCausesValidation(),
getClientClassName(),
getColumns(),
getDataChanged(),
getEnableClientScript(),
getIsValid(),
getMaxLength(),
getPersistPassword(),
getPostBackOptions(),
getReadOnly(),
getRows(),
getSafeText(),
getSafeTextParser(),
getTagName(),
getText(),
getTextMode(),
getValidationGroup(),
getWrap(),
onTextChanged(),
raisePostDataChangedEvent(),
renderBeginTag(),
renderContents(),
setAutoCompleteType(),
setAutoTrim(),
setCausesValidation(),
setColumns(),
setEnableClientScript(),
setIsValid(),
setMaxLength(),
setPersistPassword(),
setReadOnly(),
setRows(),
setText(),
setTextMode(),
setValidationGroup(),
setWrap()
|
Methods inherited from TWebControl
clearStyle(),
copyBaseAttributes(),
createStyle(),
getAccessKey(),
getBackColor(),
getBorderColor(),
getBorderStyle(),
getBorderWidth(),
getCssClass(),
getDecorator(),
getDisplay(),
getEnsureId(),
getFont(),
getForeColor(),
getHasStyle(),
getHeight(),
getStyle(),
getTabIndex(),
getToolTip(),
getWidth(),
renderEndTag(),
setAccessKey(),
setBackColor(),
setBorderColor(),
setBorderStyle(),
setBorderWidth(),
setCssClass(),
setDisplay(),
setEnsureId(),
setForeColor(),
setHeight(),
setStyle(),
setTabIndex(),
setToolTip(),
setWidth()
|
Methods inherited from TControl
__construct(),
__get(),
addParsedObject(),
addToPostDataLoader(),
addedControl(),
applyStyleSheetSkin(),
autoBindProperty(),
autoDataBindProperties(),
bindProperty(),
broadcastEvent(),
bubbleEvent(),
clearChildState(),
clearControlState(),
clearNamingContainer(),
clearViewState(),
convertUniqueIdToClientId(),
createChildControls(),
createControlCollection(),
dataBind(),
dataBindChildren(),
dataBindProperties(),
ensureChildControls(),
findControl(),
findControlsByID(),
findControlsByType(),
focus(),
getAdapter(),
getAllowChildControls(),
getAttribute(),
getAttributes(),
getChildControlsCreated(),
getClientID(),
getControlStage(),
getControlState(),
getControls(),
getCustomData(),
getEnableTheming(),
getEnableViewState(),
getEnabled(),
getHasAdapter(),
getHasAttributes(),
getHasChildInitialized(),
getHasControls(),
getHasInitialized(),
getHasLoaded(),
getHasLoadedPostData(),
getHasPreRendered(),
getID(),
getIsSkinApplied(),
getNamingContainer(),
getPage(),
getParent(),
getRegisteredObject(),
getSkinID(),
getSourceTemplateControl(),
getTemplateControl(),
getUniqueID(),
getViewState(),
getVisible(),
hasAttribute(),
initRecursive(),
isDescendentOf(),
isObjectRegistered(),
loadRecursive(),
loadState(),
loadStateRecursive(),
onDataBinding(),
onInit(),
onLoad(),
onUnload(),
preRenderRecursive(),
raiseBubbleEvent(),
registerObject(),
removeAttribute(),
removedControl(),
renderChildren(),
renderControl(),
saveState(),
saveStateRecursive(),
setAdapter(),
setAttribute(),
setChildControlsCreated(),
setControlStage(),
setControlState(),
setCustomData(),
setEnableTheming(),
setEnableViewState(),
setEnabled(),
setID(),
setPage(),
setSkinID(),
setTemplateControl(),
setViewState(),
setVisible(),
trackViewState(),
traverseChildControls(),
unbindProperty(),
unloadRecursive(),
unregisterObject()
|
Methods inherited from TComponent
__call(),
__destruct(),
__isset(),
__set(),
__sleep(),
__unset(),
__wakeup(),
asa(),
attachBehavior(),
attachBehaviors(),
attachClassBehavior(),
attachEventHandler(),
canGetProperty(),
canSetProperty(),
clearBehaviors(),
createdOnTemplate(),
detachBehavior(),
detachBehaviors(),
detachClassBehavior(),
detachEventHandler(),
disableBehavior(),
disableBehaviors(),
enableBehavior(),
enableBehaviors(),
evaluateExpression(),
evaluateStatements(),
fxAttachClassBehavior(),
fxDetachClassBehavior(),
getAutoGlobalListen(),
getBehaviorsEnabled(),
getClassHierarchy(),
getEventHandlers(),
getListeningToGlobalEvents(),
getSubProperty(),
hasEvent(),
hasEventHandler(),
hasProperty(),
isa(),
listen(),
raiseEvent(),
setSubProperty(),
unlisten()
|
Constants summary
string |
SCRIPT_PATH |
'prado/datepicker' |
#
Script path relative to the TClientScriptManager::SCRIPT_PATH
Script path relative to the TClientScriptManager::SCRIPT_PATH
|
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
|
|