PropertyEventMethodIndex
WebSquare.uiplugin.calendar - 5.0_1.3015A.20180410.143527

Creates a calender interface. The calendarClass property allows the developer to change the skin colors, and the calendarValueType provides various formats of date and time display.
Covered by div tag. Use of the calendarClass is recommended for easier change of the style.

Type

uiplugin

Property Summary

calendarClass
[default:class1, class2, class3, class4, class5] Skin type of the calendar.
calendarValueType
[default:yearMonthDate, yearMonth, yearMonthDateHour, yearMonthDateTime, yearMonthDateTimeSec] Date and time displaying type.
cancelButtonShow
[default:false, true] Shows the Cancel (X) button on the lower-right corner of the component.
caption
Sets the caption tag in HTML. (The Calendar component uses the table tag.)
delimiter
[default:/] String to separate year, month, and day.
displayHrMinSec
[default:false, true] Displays hour, minute, and second when the calendarValueType is yearMonthDateTime.
footerDiv
[default:false, true] Uses the div tag to display the user-selected date on the calendar.
id
ID of the component. Allocated as a global object. Scripts access the component through the ID.
maxYear
The highest year in the calendar.
minYear
The lowest year in the calendar.
monthNames
The names of the months. Separate month names by comma.
ref
The value of the DataCollection. Required to bind the component with a DataCollection. Starts with a prefix of "data:".
renderType
[default:component, native] Decides the the layout structure rendering method.
skipConfirm
[default: false, true] IF the user selects a month, the selection will be automatically set (without the Confirm button being displayed so that the user does not need to click the Confirm button.)
skipConfirmOnly
[default: false, true] The user can select a month by clicking arrow buttons such as << < > >> and the selected month will be automatically set. (The Confirm button will be displayed.)
summary
Similar to the summary property of the table tag in HTML.
title
Same as the title property of HTML. Displays the Text upon the end user's hovering the mouse over the browser.
toolTip
Tooltip provided by WebSquare5. Displays additional information of the component.
useMonthSelect
[default:true, false] Allows the end user to select the month when the calendarValueType is yearMonthDate. When not allowed, the user's clicking year selection box will not function.
userData1
User-defined property
userData2
User-defined property
userData3
User-defined property
useYearSelect
[default:true, false] Allows the end user to select the year when the calendarValueType is yearMonthDate. When not allowed, the user's clicking year selection box will not function.
weekStartsOn
[default:0, 1, 2, 3, 4, 5, 6] Starting day of the week (0: Sunday, ..., 6: Saturday)
yearSuffix
String to be added after the year.

Event Summary

oncancel
Triggered upon the end user's clicking the cancellation button which is displayed when the cancelButtonShow is true.
onchange
Triggered upon a change in the date by the user's selection or by API.
onclick
Triggered upon the end user's clicking the calendar.
onconfirm
Triggered upon the end user's clicking the confirmation button.
ondateselect
Triggered upon the end user's selecting a date.
ondblclick
Triggered upon the end user's double-clicking the calendar.
onviewchange
Triggered upon the end user's changing the date through keyboard input or mouse clicking.

Method Summary

addClass( className )
Adds a class to the component.
bind( eventType , function )
Dynamically allocates events to the component.
changeClass( oldClassName , newClassName )
Renames the class from oldClassName to newClassName.
focus( )
Moves the focus to the component.
getDateFormat( )
[default:yyyyMMdd] Gets the defined dateFormat.
getDisabled( )
Gets the current value of the disabled property.
getFormattedValue( )
Returns the currently selected date in the define dateFormat.
getGenerator( )
Called by a component under the Generator component. When called, gets the parent Generator object.
getID( )
Gets the ID of the component.
getOpacity( )
Gets the opacity of the component defined in CSS.
getPluginName( )
Gets the pluginName (or the name) of the component.
getPosition( positionName )
Gets the left or top position of the component.
getReadOnly( )
Gets the current setting of the readOnly property.
getSelectedDay( )
Returns the currently selected day in lower-case characters.
getSize( sizeName )
Gets the size of the component.
getStyle( propertyName )
Gets the current value of the propertyName of the component defined in CSS.
getStyleValue( style )
[deprecated] Use getStyle instead.
getTitle( )
Gets the title value.
getUserData( key )
Returns the user-defined property value set by setUserData as the user data or source (page XML).
getValue( )
Gets the value of the selected date.
gotoCalendar( dateStr )
Goes to the date of the specified dateStr on the calendar.
gotoLastMonth( )
Goes to the date that is one month prior to the selected date on the calendar.
gotoLastYear( )
Goes to the date that is one year prior to the selected date on the calendar.
gotoMonth( month )
Goes to the selected month on the calendar.
gotoNextMonth( )
Goes to the date that is one month after the selected date on the calendar.
gotoNextYear( )
Goes to the date that is one year after the selected date on the calendar.
gotoTime( hour , minute )
Goes to the selected time.
gotoToday( )
Goes to the present date on the calendar.
gotoYear( year )
Goes to the selected year on the calendar.
hasClass( className )
Checks whether the component has className received as a parameter or not.
hide( )
Hides the component.
removeAllCellClass( )
Initializes all classes of the date to which setCellClass is applied.
removeCellClass( dateStr )
Removes the class set for a certain date by setCellClass.
removeClass( className )
Removes className from the component.
setCellClass( dateStr , className )
Sets a class on the selected date.
setDateFormat( format )
Sets the dateFormat. Use getFormattedValue to get the formatted value. Depending on the calendarValueType, some strings cannot be used in the format.
setDisabled( disabled )
Disables the Calendar component.
setEventPause( evList , flag )
Disables or enables the component event.
setHoliday( dateStr )
Sets a holiday to a certain date.
setHolidayRef( setHolidayRef )
Sets the holidayRef property. To bind with the DataCollection, add "data:" prefix.
setOpacity( value )
Sets the opacity of the component.
setPosition( left , top , mode )
Sets the position (left, top) of the component.
setReadOnly( readOnly )
Controls the "readOnly" property.
setSize( width , heigth )
Sets the size (width, height) of the component.
setSkin( skinName )
Selects the skin to use.
setStyle( propertyName , value )
Sets the style of the specified property.
setUserData( key , value )
Sets the user data in the component.
show( displayType )
Displays the component on the page.
toggleClass( className )
Removes a class named className, or if there is no such a class, adds a class named className.
trigger( type , array )
Triggers a certain event registered for the component.
unbind( type , function )
Removes an event registered for the component.
visible( flag )
[deprecated] Shows/Hides the component, or sets the visible property using setStyle.

Property Detail

calendarClass
[default:class1, class2, class3, class4, class5] Skin type of the calendar.
calendarValueType
[default:yearMonthDate, yearMonth, yearMonthDateHour, yearMonthDateTime, yearMonthDateTimeSec] Date and time displaying type.
cancelButtonShow
[default:false, true] Shows the Cancel (X) button on the lower-right corner of the component.
Use the oncancel event to define the logic for the clicking event of the Cancel button.
caption
Sets the caption tag in HTML. (The Calendar component uses the table tag.)
delimiter
[default:/] String to separate year, month, and day.
displayHrMinSec
[default:false, true] Displays hour, minute, and second when the calendarValueType is yearMonthDateTime.
footerDiv
[default:false, true] Uses the div tag to display the user-selected date on the calendar.
id
ID of the component. Allocated as a global object. Scripts access the component through the ID.
maxYear
The highest year in the calendar. The default is the maxYear value under calendar node in config.xml.
minYear
The lowest year in the calendar. The default is the minYear value under calendar node in config.xml.
monthNames
The names of the months. Separate month names by comma.
ex) Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec
ref
The value of the DataCollection. Required to bind the component with a DataCollection. Starts with a prefix of "data:".
(Format: data: [DataCollection ID].[Key id or Column id]) (Example) data:dataMap1.name
When bound with a DataList, the row selected on the GridView will be bound.
Specify the XPath of the XML data to interface with the instance data. (Example) res/userInfo/name/@value
renderType
[default:component, native] Decides the the layout structure rendering method.
component : Uses div and table tags. Not recommended for web accessibility.
native : Uses the select tag of HTML to display the select box and the button tags for numbers and buttons on the calendar. Recommended for web accessibility.
skipConfirm
[default: false, true] IF the user selects a month, the selection will be automatically set (without the Confirm button being displayed so that the user does not need to click the Confirm button.)
true: Automatically set without the user’s clicking the Confirm button.
false (Default): Set upon the user’s clicking the Confirm button.
skipConfirmOnly
[default: false, true] The user can select a month by clicking arrow buttons such as << < > >> and the selected month will be automatically set. (The Confirm button will be displayed.)
true: Automatically set the selected month. (The Confirm button is displayed.)
false (Default): Set upon the user’s clicking the Confirm button after selecting a month.
summary
Similar to the summary property of the table tag in HTML. Mostly used to enhance web accessibility.
title
Same as the title property of HTML. Displays the Text upon the end user's hovering the mouse over the browser.
toolTip
Tooltip provided by WebSquare5. Displays additional information of the component. Displayed upon mouse-over.다.
useMonthSelect
[default:true, false] Allows the end user to select the month when the calendarValueType is yearMonthDate. When not allowed, the user's clicking year selection box will not function.
When not allowed, the user's clicking year selection box will not function.
userData1
User-defined property. Use getUserData("userData1") to get the data.
userData2
User-defined property. Use getUserData("userData2") to get the data.
userData3
User-defined property. Use getUserData("userData3") to get the data.
useYearSelect
[default:true, false] Allows the end user to select the year when the calendarValueType is yearMonthDate. When not allowed, the user's clicking year selection box will not function.
When not allowed, the user's clicking year selection box will not function.
weekStartsOn
[default:0, 1, 2, 3, 4, 5, 6] Starting day of the week (0: Sunday, ..., 6: Saturday)
yearSuffix
String to be added after the year.
Enter $blank to use empty space.

Event Detail

oncancel
Triggered upon the end user's clicking the cancellation button which is displayed when the cancelButtonShow is true.
Sample
// Clicking the cancellation button will move to 2002-Apr-15. this.gotoCalendar("20020415"); // Use this to directly access the Calendar component within the event handler.
onchange
Triggered upon a change in the date by the user's selection or by API.
For the changes triggered by the user's action only, use the onviewchange event.
onclick
Triggered upon the end user's clicking the calendar.
Parameter
nametypedescription
eObjectEvent object
onconfirm
Triggered upon the end user's clicking the confirmation button. When the calendarValueType is yearMonthDate, the onconfirm event is only triggered by the configmration button.
ondateselect
Triggered upon the end user's selecting a date.
Parameter
nametypedescription
dateStrStringSelected date
dateObjDateDate object of the selected date
Sample
// Parameters upon the end user's selecting 2002-Apr-15. dateStr : "20020415" (String object) dateObj : Mon Apr 15 2002 00:00:00 GMT+0900 (Date object)
ondblclick
Triggered upon the end user's double-clicking the calendar.
Parameter
nametypedescription
eObjectEvent object
onviewchange
Triggered upon the end user's changing the date through keyboard input or mouse clicking.
In case the change was made by a script, no event will be triggered. (Similar to the native onchange event.)
Parameter
nametypedescription
infoJSONReturns JSON data containing oldValue and newValue. <String> info.oldValue : Old value <String> info.newValue : New value
Sample
// Upon user's changing the date from 2002-Apr-15 to 2099-Dec-31. <script ev:event="onviewchange( info )"><![CDATA[ var oldValue = info.oldValue; //이전 값 //return 예시 ) "20020415" var newValue = info.newValue; //선택 된 값 //return 예시 ) "20991231" ]]></script>

Method Detail

addClass( className )
Adds a class to the component.
Parameter
nametyperequireddescription
classNameStringYName of the class to add
Sample
// Add oddClass to component input1. input1.addClass("oddClass");
bind( eventType , function )
Dynamically allocates events to the component.
Parameter
nametyperequireddescription
eventTypeStringYName of the event to allocate.
functionFunctionYHandler function of the event to allocate.
Sample
// Define the event handler function for the onclick event in the input component, and bind the function. input1.bind("onclick", function(e){ alert(input1.getValue();})); // Bind commObj.ev_click function for the onclick event with component input1. var commObj = {}; commObj.ev_click = function(e){ alert("click :: "+this.id); }; input1.bind("onclick", commObj.ev_click );
changeClass( oldClassName , newClassName )
Renames the class from oldClassName to newClassName.
In the default setting, only the classes added by addClass will be applied. In order to directly remove the class defined in the "class" property of the component, add the following setting in config.xml file.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
oldClassNameStringYName of the class to remove
newClassNameStringYName of the class to add
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // Add the following to config.xml. <style> <removeDefaultClass value="true" /> </style> // Change tmpInputClass class to tmpInputWarninClass. input1.changeClass("tmpInputClass","tmpInputWarninClass");
focus( )
Moves the focus to the component.
getDateFormat( )
[default:yyyyMMdd] Gets the defined dateFormat.
Return
typedescription
StringdateFormat string such as yyyy/MM/dd or yyyy-MM-dd"
Sample
// If dateFormat has not been specified by setDateFormat, var returnValue = calendar1.getDateFormat(); // (Return Example) "yyyyMMdd"
getDisabled( )
Gets the current value of the disabled property.
Return
typedescription
BooleanThe value of the disabled property.
Sample
var returnValue = componentId.getDisabled(); (Return example) false
getFormattedValue( )
Returns the currently selected date in the define dateFormat.
If dateFormat is not applied, date and time information will be returned without separators. (Depending on the calendarValueType, the date and time format will differ.)
(Remarks) Use setDateFormat to set the dateFormat.
Return
typedescription
StringFormatted date string
Sample
// No dateFormat is applied, and the current selection is 2002-Apr-15. // No dateFormat is applied, and the current selection is 2002-Apr-15. var tmpRs1 = calendar1.getFormattedValue(); // (Return Example) "20020415" // calendarValueType="yearMonth" var tmpRs2 = calendar1.getFormattedValue(); // (Return Example) "200204" // Apply the dateFormat. (Use setDateFormat depending on the calendarValueType option. See setDateFormat.) calendar1.setDateFormat("yyyy MM-dd"); // No dateFormat is applied, and the current selection is 2002-Apr-15. var tmpRs3 = calendar1.getFormattedValue(); // (Return Example) ""2002 04-15""
getGenerator( )
Called by a component under the Generator component. When called, gets the parent Generator object.
Return
typedescription
ObjectParent Generator object
Sample
<w2:generator id="generator1"> <w2:trigger id="trigger1" ev:onclick="scwin.trigger1_onclick"></w2:trigger></w2:generator> scwin.trigger1.onclick = function(){ console.log(this.getGenerator());} // Click trigger1 to display the generator1 object on the console. // See https://inswave.com/jira/browse/WPF-1425.
getID( )
Gets the ID of the component.
Return
typedescription
StringID of the WebSquare5 component
Sample
// The WebSquare5 component dynamically received as a parameter can be used as shown in the following. function fn_validCheck(tmpObj){ // tmpObj has an ID of "input1". var compID = tmpObj.getID(); // (Return Example) "input1" }
getOpacity( )
Gets the opacity of the component defined in CSS.
Return
typedescription
IntegerOpacity
Sample
// Apply opacity CSS to the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;opacity:0.2;"></xf:input> var returnValue = input1.getOpacity(); // "returnValue" is a real number between 0 and 1. // (Return Value) "0.2"
getPluginName( )
Gets the pluginName (or the name) of the component.
Return
typedescription
StringpluginName of the WebSquare5 component
Sample
// For a WebSquare5 object dynamically received by a common function, conditional statements can be used as shown below. var commObj = {}; commObj.fn_makeReqData = function(tmpObj){ var tmpID = tmpObj.getID(); // Component ID var tmpCompType = tmpObj.getPluginName(); // Component Type if(tmpCompType == "input"){ //..Logic.. }else if(tmpCompType == "gridView"){ //..Logic .. }else{ //..Logic.. } };
getPosition( positionName )
Gets the left or top position of the component. If set by %, the corresponding pixel value will be returned.
Parameter
nametyperequireddescription
positionNameStringY[left,top] Type of the position
Return
typedescription
NumberPosition of the component
Sample
// Apply margin CSS to the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;margin:10px;"></xf:input> var returnValue = input1.getPosition("top"); // The returnValue will be a position in pixels. // (Return Example) 10
getReadOnly( )
Gets the current setting of the readOnly property.
Return
typedescription
BooleanThe current setting of the readOnly property
Sample
var returnValue = componentId.getReadOnly(); // (Return Example) false
getSelectedDay( )
Returns the currently selected day in lower-case characters.
If not specified, "" (empty string) will be returned.
Return
typedescription
String[sunday, monday, tuesday, wednesday, thursday, friday, saturday] Day string
Sample
// Current selection: 2011-Jan-01 var returnValue = calendar1.getSelectedDay(); // (Return Example) "saturday"
getSize( sizeName )
Gets the size of the component. If set by "%", the corresponding pixel value will be returned.
Parameter
nametyperequireddescription
sizeNameStringY[height, innerHeight, outerHeight, outerMarginHeight, width, innerWidth, outerWidth, outerMarginWidth] Type of the size. For the calculation of each size type, see below.
height : element.clientHeight innerHeight : element.clientHeight + padding outerHeight : element.clientHeight + padding + border outerMarginHeight : element.clientHeight + padding + border + margin width : element.clientWidth innerWidth : element.clientWidth + padding outerWidth : element.clientWidth + padding + border outerMarginWidth : element.clientWidth + padding + border + margin
Return
typedescription
NumberSize of the component
Sample
var returnValue = componentId.getSize("width"); // "returnValue" will be a size in pixels. If set by "%", the corresponding pixel value will be returned. // (Return Example) 100
getStyle( propertyName )
Gets the current value of the propertyName of the component defined in CSS.
Parameter
nametyperequireddescription
propertyNameStringYName of the property in the style
Return
typedescription
StringStyle value
Sample
// Define an Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;"></xf:input> var returnValue = input1.getStyle("width"); // (Return Example) "144px"
getStyleValue( style )
[deprecated] Use getStyle instead.
Gets the current value of the propertyName of the component defined in CSS.
Parameter
nametyperequireddescription
styleStringYName of the property defined in the style
Return
typedescription
StringValue defined in the style property. (In case of a color, the hexcode of the color will be returned.)
getTitle( )
Gets the title value.
Return
typedescription
StringTitle value
Sample
// Define the "title" for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" title="이름 입력"></xf:input> var tmpTitle = input1.getTitle(); // (Return Example ) "Input Name"
getUserData( key )
Returns the user-defined property value set by setUserData as the user data or source (page XML).
Parameter
nametyperequireddescription
keyStringYRandom data key
Return
typedescription
StringData of the corresponding key
Sample
// Apply the customized property (eduTest) to the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" eduTest="Hello"></xf:input> input1.getUserData("eduTest"); // (Return Example) "Hello" // Use setUserData. input1.setUserData("eduTest","WebSquare"); input1.getUserData("WebSquare"); // (Return Example) "Hello"
getValue( )
Gets the value of the selected date.
Return
typedescription
StringString without delimiters
Sample
// Current selection: 2011-Jan-01 // In case the calendarValueType is yearMonthDate or not specified, the return will be in yyyyMMdd format. var returnValue = calendar1.getValue(); // (Return Example) "20110101" // In case the calendarValueType is yearMonth, the return will be in yyyyMM format. // (Return Example) "201101" In case the calendarValueType is yearMonthDateTime, the return will be in yyyyMMddHHmm format. // (Return Example) "201101010000" In case the calendarValueType is yearMonthDateTimeSec, the return will be in yyyyMMddHHmmss format. // (Return Example) "20110101000000"
gotoCalendar( dateStr )
Goes to the date of the specified dateStr on the calendar.
dateStr is in yyyyMMdd format without delimiters.
Parameter
nametyperequireddescription
dateStrStringYDate to go to (in yyyyMMdd format)
Sample
// Go to 2002-Apr-15. calendar1.gotoCalendar("20020415");
gotoLastMonth( )
Goes to the date that is one month prior to the selected date on the calendar.
Sample
// Current selection: 2011-Jan-01 calendar1.gotoLastMonth(); // (Display Example) 2010-Dec-01 will be selected.
gotoLastYear( )
Goes to the date that is one year prior to the selected date on the calendar.
Sample
// Current selection: 2011-Jan-01 calendar1.gotoLastYear(); // (Display Example) Jan 01 2010 will be selected.
gotoMonth( month )
Goes to the selected month on the calendar.
If not valid, moves to the first month (1).
Parameter
nametyperequireddescription
monthString||NumberYMonth to go to ("02", "2", and 2 are all to go to February.)
Sample
// Current selection: 2011-Jan-01 calendar1.gotoMonth(5); // "05" , "5" , and 5 are all same. // (Display Example) May-01-2011 will be selected.
gotoNextMonth( )
Goes to the date that is one month after the selected date on the calendar.
Sample
// Current selection: 2011-Jan-01 calendar1.gotoNextMonth(); // (Display Example) 2011-May-01 will be selected.
gotoNextYear( )
Goes to the date that is one year after the selected date on the calendar.
Sample
// Current selection: 2011-Jan-01 calendar1.gotoNextYear(); // (Display Example) 2012-Jan-01 will be selected.
gotoTime( hour , minute )
Goes to the selected time.
If not valid, initial hour (0) and initial minute (0) will be selected.
Parameter
nametyperequireddescription
hourNumber||StringYHour to go to.("02", "2", and 2 are all to set two o'clock.)
minuteNumber||StringYMinute to go to.("05", "5", and 5 are all to set minute 5.)
Sample
// Can be used for a calendar of yearMonthDateTime type. calendar1.gotoTime("01","11"); // All of "01", "1", and 1 are for one o'clock. // (Display Example) Goes to 1:11.
gotoToday( )
Goes to the present date on the calendar.
Sample
// Create same effects such as clicking Today or Now on the calendar of the yearMonthDate format. calendar1.gotoToday();
gotoYear( year )
Goes to the selected year on the calendar.
If not valid, the first year will be selected.
Parameter
nametyperequireddescription
yearString||NumberYYear to go to.("2002", and 2002 are all to go to 2002.)
Sample
// Current selection: 2011-Jan-01 calendar1.gotoYear("2020"); // (Display Example) 2020-Jan-01 will be selected.
hasClass( className )
Checks whether the component has className received as a parameter or not.
Parameter
nametyperequireddescription
classNameStringYclassName to check
Return
typedescription
BooleanWhether the component has the class or not
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> var returnValue = input1.hasClass("tmpInputClass"); // (Return Example) true
hide( )
Hides the component.
removeAllCellClass( )
Initializes all classes of the date to which setCellClass is applied.
Sample
// Define tmpColor01 class in the style. <style type="text/css"><![CDATA[ .tmpColor01{ color:orange; } ]]></style> calendar1.setCellClass( "20151015","tmpColor01" ); calendar1.setCellClass( "20150915","tmpColor01" ); calendar1.setCellClass( "20150815","tmpColor01" ); calendar1.removeAllCellClass(); // All classes will be removed from the cells.
removeCellClass( dateStr )
Removes the class set for a certain date by setCellClass.
Parameter
nametyperequireddescription
dateStrStringYDate for which the class is set
Sample
// Define tmpColor01 class in the style. <style type="text/css"><![CDATA[ .tmpColor01{ color:orange; } ]]></style> calendar1.setCellClass("20020415", "tmpColor01"); calendar1.removeCellClass("20020415"); // (Display Example) The date of 2002-Apr-15 will be displayed in orange.
removeClass( className )
Removes className from the component.
In the default setting, only the classes added by addClass will be applied. In order to directly remove the class defined in the "class" property of the component, add the following setting in config.xml file.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
classNameStringYName of the class to remove
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // Add the following to config.xml. <style> <removeDefaultClass value="true" /> </style> // Remove tmpInputClass class. input1.removeClass("tmpInputClass");
setCellClass( dateStr , className )
Sets a class on the selected date.
Parameter
nametyperequireddescription
dateStrStringYDate for which the class is set
classNameStringYName of the class to set
Sample
// Define tmpColor01 class in the style. <style type="text/css"><![CDATA[ .tmpColor01{ color:orange; } ]]></style> calendar1.setCellClass("20020415", "tmpColor01"); // (Display Example) The date of 2002-Apr-15 will be displayed in orange color.
setDateFormat( format )
Sets the dateFormat. Use getFormattedValue to get the formatted value. Depending on the calendarValueType, some strings cannot be used in the format.
When the calendarValueType is yearMonthDate, yyyy, MM, and dd can be used.
When the calendarValueType is yearMonth, yyyy and MM can be used.
When the calendarValueType is yearMonthDateTime, yyyy, MM, dd, HH, and mm can be used.
When calendarValueType is yearMonthDateTimeSec, yyyy, MM, dd, HH, mm, and SS can be used.
Parameter
nametyperequireddescription
formatStringYdateFormat (A string like yyyy-MM-dd)
Sample
// The current selection is 2002-Apr-15. Apply the format. calendar1.setDateFormat("yyyy MM-dd"); // Return the formatted value. var tmpVal1 = calendar1.getFormattedValue(); // (Return Example) "2002 04-15" // Return the value. var tmpVal2 = calendar1.getValue(); // (Return Example) "20020415" // Not formatted.
setDisabled( disabled )
Disables the Calendar component.
Parameter
nametyperequireddescription
disabledBooleanYBoolean value (true, false) to set disabled
Sample
calendar1.setDisabled(true);
setEventPause( evList , flag )
Disables or enables the component event.
Parameter
nametyperequireddescription
evListStringNList of the events. If not specified, all user events of the component will be listed. (Enter null data.)
flagBooleanYtrue is to pause, or false is to cancel pausing.
Sample
input1.setEventPause("onclick", true); // Dynamically pauses the onclick event. input1.setEventPause("onfocus,onblur", false); // Restarts the onfocus and the onblur events. input1.setEventPause(null, true); // Pauses all user events registered for the Input component.
setHoliday( dateStr )
Sets a holiday to a certain date.
Parameter
nametyperequireddescription
dateStrStringYDate of the holiday
Sample
calendar1.setHoliday("20160627"); // calendar1.setHoliday("*0815"); is to set the holiday for all years. // (Display Example) The date of 2016-Jun-27 will be displayed in red.
setHolidayRef( setHolidayRef )
Sets the holidayRef property. To bind with the DataCollection, add "data:" prefix.
If not specified, XPath of the InstanceData will be used.
Parameter
nametyperequireddescription
setHolidayRefStringYPath of the setHolidayRef to apply.
Sample
// Set holidays in col of dataList1 in the Calendar component. calendar.setHolidayRef("data:dataList1.col1"); // Bind with test/holiday of the InstanceData. calendar.setHolidayRef("test/holiday");
setOpacity( value )
Sets the opacity of the component.
Parameter
nametyperequireddescription
valueNumberYOpacity value (A real number between 0 and 1)
Sample
componentId.setOpacity(0.45);
setPosition( left , top , mode )
Sets the position (left, top) of the component.
Parameter
nametyperequireddescription
leftNumberYLeft position or null.
topNumberYTop position or null.
modeStringN[defulat:absolute, delta] absolute sets the current positions as x and y, and delta adds x and y to the current positions.
Sample
// Set the top position of the component as 100 pixels. componentId.setPosition(null, 100);
setReadOnly( readOnly )
Controls the "readOnly" property. True to enable, or false to disable.
Parameter
nametyperequireddescription
readOnlyBooleanYTrue to enable, or false to disable.
Sample
// Enable the read-only. componentId.setReadOnly(true);
setSize( width , heigth )
Sets the size (width, height) of the component.
Parameter
nametyperequireddescription
widthNumberYComponent width or null
heigthNumberYComponent height or null
Sample
// Set the component height as 100 pixels. componentId.setSize(null,100);
setSkin( skinName )
Selects the skin to use.
Parameter
nametyperequireddescription
skinNameStringY[class1, class2, class3, class4, class5] Name of the skin to use.
Sample
calendar1.setSkin("class2");
setStyle( propertyName , value )
Sets the style of the specified property.
Parameter
nametyperequireddescription
propertyNameStringYName of the style
valueStringYValue of the style
Sample
// Set the component width as 200px. componentId.setStyle("width", "200px"); // Change the background color to olive. componentId.setStyle("background-color","olive");
setUserData( key , value )
Sets the user data in the component. If the key cannot be set for the component, corresponding logs will be displayed.
Parameter
nametyperequireddescription
keyStringYRandom data key
valueStringYRandom data key
Sample
// Setting a (key, value) pair of ("data", "WebSquare5") in the component. componentId.setUserData("data", "WebSquare"); // Some keys cannot be set for the component. componentId.setUserData("title", "WebSquare"); // (Log Example) !!!WARNING - [title] can't define as UserData
show( displayType )
Displays the component on the page.
Parameter
nametyperequireddescription
displayTypeStringNValue of the display property
toggleClass( className )
Removes a class named className, or if there is no such a class, adds a class named className.
In the default setting, only the classes added by addClass can be removed. To remove other classes, add the following setting in config.xml.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
classNameStringYclassName to set
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // Add the following to config.xml. <style> <removeDefaultClass value="true" /> </style> // Remove tmpInputClass class. input1.toggleClass("tmpInputClass"); // Add tmpInputClass class again. input1.toggleClass("tmpInputClass");
trigger( type , array )
Triggers a certain event registered for the component.
Parameter
nametyperequireddescription
typeStringYName of the event to trigger
arrayArrayNArray of parameters to send to the event handler
Sample
// Trigger the onclick event in the input1 component. input1.trigger("onclick"); // Trigger the onviewchange event in the input component and call the event handler function by sending arguments of (1, 2). input1.trigger("onviewchange", [1,2]);
unbind( type , function )
Removes an event registered for the component.
Parameter
nametyperequireddescription
typeStringNName of the event to remove. If not specified, all events of the components will be removed.
functionFunctionNHandler function of the event to remove. If not specified, all handler functions of the event will be removed.
Sample
// Remove all events registered in the input component. input1.unbind(); // Remove all handler functions of onviewchange event registered in the input component. input1.unbind("onviewchange"); // Remove the func1 event handler of onviewchange event registered for component input1. input1.unbind("onviewchange", func1);
visible( flag )
[deprecated] Shows/Hides the component, or sets the visible property using setStyle.
Sets the visibility of the component style. In case of true, set visible. In case of false, set hidden.
Parameter
nametyperequireddescription
flagBooleanYVisibility (In case of true, set visible. In case of false, set hidden.)