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

Functions same as type="checkbox" in the input tag of HTML, and allows the end user to make multiple selections.
Note, however, that div tags, not input tags, are at the highest level. In order to use the input tag, make an additional setting.

Type

uiplugin

Property Summary

appearance
The appearance property of xforms select1
class
Provides a similar feature to the class in HTML. One or more classes defined in the CSS file or the style block can be used.
cols
Number of the columns to list items.
disabled
[default:false, true] Disables the component.
displaymessage
[default:false, true] Displays the result message upon a validation failure by the validation API.
escape
Converts <>&" characters into HTML Escape characters.
falseValue
The value for the case when no item is selected.
id
ID of the component. Allocated as a global object. Scripts access the component through the ID.
ignoreTabIndex
Ignores the focus upon tab moving.
invalidMessage
A message displayed upon failure of the validation API. The displaymessage property must be true.
invalidMessageFunc
Name of the function that dynamically displays messages upon a validation failure by the validation API.
itemTagname
The tagname of the item when the renderType is checkboxgroup.
mandatory
[default:false, true] Whether to check the mandatory input or not when calling the validation API.
ref
The value of the DataCollection. Required to bind the component with a DataCollection. Starts with a prefix of "data:".
renderType
[default:table, native, checkboxgroup] Decides the the layout structure rendering method.
rows
Number of the rows to show the items. For example, value 2 means that the items will be displayed on two rows.
selectedindex
Index of the default selection. Functions only when the index is hard-coded or pre-defined in the DataList.
separator
Separators in case multiple items are selected.
tabIndex
Same as the tabindex property in HTML standard. Indicates the focusing order of the component by the tab key.
tagname
The tagname of the object to be rendered when the renderType is checkboxgroup.
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.
useCheckboxTitle
[default:true, false] Display of the title on the checkbox button for web accessibility
useLocale
[default:false, true] True to use the multi-language key to display the labels on the WebSquare5 client.
userData1
User-defined property
userData2
User-defined property
userData3
User-defined property
validator
Name of the validation function

Event Summary

onchange
Triggered upon the end user's selecting/changing an item or setting a value. Use the onviewchange event to control only the end user's selecting an item.
oncheckboxclick
Triggered upon the end user's clicking a checkbox, not a label.
onlabelclick
Triggered upon the end user's clicking a label, not a checkbox.
onviewchange
Triggered when the value on the list is changed 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.)

Method Summary

addClass( className )
Adds a class to the component.
addItem( value , label , index )
Adds an item. If the index is not specified, the item will be added as a sub-item.
bind( eventType , function )
Dynamically allocates events to the component.
changeClass( oldClassName , newClassName )
Renames the class from oldClassName to newClassName.
checkAll( checkFlag )
Checks or unchecks all items.
click( index )
Functions same as clicking of an item of the corresponding index. Selects/Unselects the item.
deleteItem( index )
Deletes the item of the corresponding index.
focus( )
Moves the focus to the component.
getDataListInfo( )
Returns the dataList bound with the checkbox component.
getDisabled( )
Gets the current value of the disabled property.
getGenerator( )
Called by a component under the Generator component. When called, gets the parent Generator object.
getID( )
Gets the ID of the component.
getItemCount( )
Returns the number of the items.
getItemDisabled( index )
Returns the disabled status of the item of the corresponding index.
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.
getSelectedIndex( separator )
Returns the index of the selected item. Multiple indices can be returned through the use of a separator.
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.
getText( separator )
Gets the label of the currently selected item. For multiple items, uses a separator.
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( separator )
Gets the value of the currently selected item. Uses a separator for multiple values.
hasClass( className )
Checks whether the component has className received as a parameter or not.
hide( )
Hides the component.
removeAll( )
Removes all items.
removeClass( className )
Removes className from the component.
reset( )
Unchecks all items.
setDisabled( disabled )
Sets the disabled property.
setEventPause( evList , flag )
Disables or enables the component event.
setItemDisabled( index , falg )
Disables or enables the item of the corresponding index.
setNodeSet( nodeset , label , value )
Changes the itemset setting. When bound with a DataList, the nodeset must start with data: prefix.
setOpacity( value )
Sets the opacity of the component.
setPosition( left , top , mode )
Sets the position (left, top) of the component.
setRef( ref )
Dynamically sets the ref binding. Add data: prefix to bind with a DataCollection.
setSelectedIndex( index )
Checks/Unchecks (or toggles) the item of the corresponding index.
setSize( width , heigth )
Sets the size (width, height) of the component.
setStyle( propertyName , value )
Sets the style of the specified property.
setUserData( key , value )
Sets the user data in the component.
setValue( value )
Selects an item which contains the value received as a parameter, and sets the value in the selected item.
show( displayType )
Displays the component.
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.
unbindRef( )
Releases the ref binding.
validate( )
Validates the component according to the specified properties.
visible( flag )
[deprecated] Shows/Hides the component, or sets the visible property using setStyle.

Property Detail

appearance
The appearance property of xforms select1
class
Provides a similar feature to the class in HTML. One or more classes defined in the CSS file or the style block can be used.
The WebSquare5 Engine has a dedicated class to each component. Using the class of the component, the developer can apply a common CSS.
cols
Number of the columns to list items.
disabled
[default:false, true] Disables the component.
displaymessage
[default:false, true] Displays the result message upon a validation failure by the validation API.
Displays the result message upon a validation failure by the validation API. Define a customized message using the invalidMessageFunc property.
escape
Converts <>&" characters into HTML Escape characters.
falseValue
The value for the case when no item is selected.
When not selected, the value will be " " (empty string.) Otherwise, the corresponding value of the property will be returned.
id
ID of the component. Allocated as a global object. Scripts access the component through the ID.
ignoreTabIndex
Ignores the focus upon tab moving.
invalidMessage
A message displayed upon failure of the validation API. The displaymessage property must be true.
Cannot be used with invalidMessageFunc at the same time.
invalidMessageFunc
Name of the function that dynamically displays messages upon a validation failure by the validation API.
The displaymessage property must be true. Cannot be used with invalidMessage at the same time.
The customized function (in the following example) gets the type of the value through this.getType() and the value through this.getValue(), and returns the dynamically created message through the use of the type and the value.
(Type) mandatory, allowChar, ignoreChar, minLength, maxLength, minByteLength, maxByteLength
(Example) function fn_msg(){ var tmpType = this.getType(); var tmpValue = this.getValue(); if(tmpType == "mandatory"){ return "Required."; } }
itemTagname
The tagname of the item when the renderType is checkboxgroup.
mandatory
[default:false, true] Whether to check the mandatory input or not when calling the validation API.
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.dept
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/dept/@value
renderType
[default:table, native, checkboxgroup] Decides the the layout structure rendering method.
table : Uses table tag under div tag, not input tag.
native : <input type="checkbox"> Create label tag using the TextBox component. Mandatory when the title property is not used (to comply with web accessibility requirements).
checkboxgroup : Allows the developer to decide the tag. The default is div tag. Set the highest-level tag and other tags using tagname and itemTagname properties.
rows
Number of the rows to show the items. For example, value 2 means that the items will be displayed on two rows.
selectedindex
Index of the default selection. Functions only when the index is hard-coded or pre-defined in the DataList.
Note that the default selection is made when the component is initially rendered on the browser. After items are added after browser loading or once data is allocated to the DataList after data submission, this property will not be valid.
separator
Delimiter when multiple items are selected. If not specified, space will be used.
tabIndex
Same as the tabindex property in HTML standard. Indicates the focusing order of the component by the tab key.
tagname
The tagname of the object to be rendered when the renderType is checkboxgroup.
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.다.
useCheckboxTitle
[default:true, false] Display of the title on the checkbox button for web accessibility
useLocale
[default:false, true] True to use the multi-language key to display the labels on the WebSquare5 client.
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.
validator
Name of the validation function

Event Detail

onchange
Triggered upon the end user's selecting/changing an item or setting a value. Use the onviewchange event to control only the end user's selecting an item.
The event handler (this function) can access the component. (Example) this.getValue();
oncheckboxclick
Triggered upon the end user's clicking a checkbox, not a label.
The event handler (this function) can access the component. (Example) this.getValue();
Parameter
nametypedescription
indexStringIndex of the triggered item
checkedbooleanChecked status of the triggered item
valueStringValue of the triggered item
Sample
<script ev:event="oncheckboxclick( index, checked, value )"><![CDATA[ var itemIndex = index; //item의 index var itemChecked = checked; //item의 선택 여부 var itemValue = value; //item의 value var compValue = this.getValue(); //컴포넌트의 value ]]></script>
onlabelclick
Triggered upon the end user's clicking a label, not a checkbox.
The event handler (this function) can access the component. (Example) this.getValue();
Parameter
nametypedescription
indexStringIndex of the triggered item
checkedbooleanChecked status of the triggered item
valueStringValue of the triggered item
Sample
<script ev:event="onlabelclick( index, checked, value )"><![CDATA[ var itemIndex = index; //item의 index var itemChecked = checked; //item의 선택 여부 var itemValue = value; //item의 value var compValue = this.getValue(); //컴포넌트의 value ]]></script>
onviewchange
Triggered when the value on the list is changed 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.)
The event handler (this function) can access the component. (Example) this.getValue();
Parameter
nametypedescription
infoJSONReturns an object containing index, checked, and value. <Number> info.index : Index of the triggered item <Boolean> info.checked : Checked status of the triggered item <String> info.value : Value of the triggered item
Sample
<script ev:event="onviewchange( info )"><![CDATA[ var itemIndex = info.index; //item의 index var itemChecked = info.checked; //item의 선택 여부 var itemValue = info.value; //item의 value var compValue = this.getValue(); //컴포넌트의 value ]]></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");
addItem( value , label , index )
Adds an item. If the index is not specified, the item will be added as a sub-item.
Parameter
nametyperequireddescription
valueStringYValue of the item
labelStringYLabel of the item
indexNumberNIndex of the item
Return
typedescription
NumberIndex of the added item
Sample
// Hard-code as shown below. <xf:select id="checkbox1" appearance="full" style="position: relative;" selectedindex="-1" > <xf:choices> <xf:item> <xf:label><![CDATA[사과]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[체리]]></xf:label> <xf:value><![CDATA[2]]></xf:value> </xf:item> </xf:choices> </xf:select> var returnValue = checkbox1.addItem( '3', 'ornage' ); // (Return Example) 2
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");
checkAll( checkFlag )
Checks or unchecks all items.
Parameter
nametyperequireddescription
checkFlagBooleanYtrue is to check all, or false is to uncheck all.
Sample
// Check all. checkbox1.checkAll(true); // Uncheck all. checkbox1.checkAll(false);
click( index )
Functions same as clicking of an item of the corresponding index. Selects/Unselects the item.
Other events such as the onviewchange may be also triggered.
Parameter
nametyperequireddescription
indexNumberYIndex of the item to trigger a click event
Sample
// Trigger a click event for the first item. checkbox1.click(0); // Select/Unselect all.
deleteItem( index )
Deletes the item of the corresponding index.
Parameter
nametyperequireddescription
indexNumberNIndex of the item to delete
Return
typedescription
JSONJSON containing information of the deleted item
<String> label : Label of the item <String> value : Value of the item
Sample
// Hard-code as shown below. <xf:select id="checkbox1" appearance="full" style="position: relative;" selectedindex="-1" > <xf:choices> <xf:item> <xf:label><![CDATA[사과]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[체리]]></xf:label> <xf:value><![CDATA[2]]></xf:value> </xf:item> </xf:choices> </xf:select> var returnValue = checkbox1.deleteItem( 0 ); // (Return Example) {label: "Apple", value: "1"}
focus( )
Moves the focus to the component.
getDataListInfo( )
Returns the dataList bound with the checkbox component.
Return
typedescription
Object:YReturns nodeset, label, and value id as an object.
Sample
checkbox1.getDataListInfo();
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
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" }
getItemCount( )
Returns the number of the items.
Return
typedescription
NumberNumber of the items
Sample
// When there are total two items var returnValue = checkbox1.getItemCount(); // (Return Example) 2
getItemDisabled( index )
Returns the disabled status of the item of the corresponding index.
Parameter
nametyperequireddescription
indexNumberYIndex of the item
Return
typedescription
BooleanDisabled status of the item
Sample
// Get the disabled status of the first item which is enabled. var returnValue = checkbox1.getItemDisabled(0); // (Return Example) false
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
getSelectedIndex( separator )
Returns the index of the selected item. Multiple indices can be returned through the use of a separator.
If not specified, space will be used as the delimiter.
Parameter
nametyperequireddescription
separatorStringNSeparator
Return
typedescription
StringString containing the index of the selected item.
Sample
// The component is defined, and Apple and Orange are selected. <xf:select id="checkbox1" appearance="full" style="position: relative;" selectedindex="-1" > <xf:choices> <xf:item> <xf:label><![CDATA[사과]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[체리]]></xf:label> <xf:value><![CDATA[2]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[오렌지]]></xf:label> <xf:value><![CDATA[3]]></xf:value> </xf:item> </xf:choices> </xf:select> var returnValue1 = checkbox1.getSelectedIndex(); // (Return Example) "0 2" // The comma is used as the separator. var returnValue2 = checkbox1.getSelectedIndex(","); // (Return Example) "0,2"
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.)
getText( separator )
Gets the label of the currently selected item. For multiple items, uses a separator.
If not specified, space will be used as the delimiter.
Parameter
nametyperequireddescription
separatorStringNSeparator
Return
typedescription
StringString containing labels of the selected items
Sample
// The component is defined, and Apple and Orange are selected. <xf:select id="checkbox1" appearance="full" style="position: relative;" selectedindex="-1" > <xf:choices> <xf:item> <xf:label><![CDATA[사과]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[체리]]></xf:label> <xf:value><![CDATA[2]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[오렌지]]></xf:label> <xf:value><![CDATA[3]]></xf:value> </xf:item> </xf:choices> </xf:select> var returnValue = checkbox1.getText(); // (Return Example) "Apple Orange" // Use the separator. var returnValue = checkbox1.getText(","); // (Return Example) "Apple,Orange"
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( separator )
Gets the value of the currently selected item. Uses a separator for multiple values.
If not specified, space will be used as the delimiter.
Parameter
nametyperequireddescription
separatorStringNSeparator
Return
typedescription
StringString containing the values of the selected items.
Sample
// The component is defined, and Apple and Orange are selected. <xf:select id="checkbox1" appearance="full" style="position: relative;" selectedindex="-1" > <xf:choices> <xf:item> <xf:label><![CDATA[사과]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[체리]]></xf:label> <xf:value><![CDATA[2]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[오렌지]]></xf:label> <xf:value><![CDATA[3]]></xf:value> </xf:item> </xf:choices> </xf:select> var returnValue = checkbox1.getValue(); // (Return Example) "1 3"
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.
he CSS setting will be "display:none;" and "visibility:hidden;".
Sample
componentId.hide();
removeAll( )
Removes all items.
Sample
checkbox1.removeAll();
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");
reset( )
Unchecks all items.
Sample
// Uncheck all. checkbox1.reset();
setDisabled( disabled )
Sets the disabled property. True to disable, or false not to disable.
Parameter
nametyperequireddescription
disabledBooleanYTrue to disable, or false not to disable.
Sample
// Disable the component. componentId.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.
setItemDisabled( index , falg )
Disables or enables the item of the corresponding index.
Parameter
nametyperequireddescription
indexNumberYIndex of the item
falgBooleanYDisabled status
Sample
// Disable the first item. checkbox1.setItemDisabled(0, true); // The item cannot be selected or unselected.
setNodeSet( nodeset , label , value )
Changes the itemset setting. When bound with a DataList, the nodeset must start with data: prefix.
Parameter
nametyperequireddescription
nodesetStringYAdd data: prefix (or the XPath of the instance data) to the Id of the DataList.
labelStringNID of the column to be used as the label. If not specified, the existing value will be used. (Or XPath under the nodeset to set for the label.)
valueStringNID of the column to be used as the value. If not specified, the existing value will be used. (Or XPath under the nodeset to set for the value.)
Sample
// Define a DataList as shown below. <w2:dataList id="dataList1"> <w2:columnInfo> <w2:column id="lbl" dataType="text"></w2:column> <w2:column id="code" dataType="text"></w2:column> </w2:columnInfo> <w2:data use="true"> <w2:row> <lbl><![CDATA[zero]]></lbl> <code><![CDATA[0]]></code> </w2:row> <w2:row> <lbl><![CDATA[one]]></lbl> <code><![CDATA[1]]></code> </w2:row> </w2:data> </w2:dataList> // Change the itemset of checkbox1 into dataList1 of the DataCollection, and set the label as lbl column and value as code column. checkbox1.setNodeSet('data:dataList1','lbl','code'); // Change to dataList2 which has same columns with dataList1 but different data. checkbox1.setNodeSet('data:dataList2'); // Existing labels and values are maintained, and only dataList is changed.
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);
setRef( ref )
Dynamically sets the ref binding. Add data: prefix to bind with a DataCollection.
If not specified, XPath of the InstanceData will be used.
Parameter
nametyperequireddescription
refStringYPath of the ref to apply
Sample
// Bind hobby key of dataMap1 with the checkcombobox1 component. checkbox1.setRef("data:dataMap1.hobby"); // Bind with res/userData/hobby of the InstanceData. checkbox1.setRef("res/userData/hobby");
setSelectedIndex( index )
index에 해당하는 항목을 check/uncheck(toggle)한다.
Parameter
nametyperequireddescription
indexNumberYIndex of the item
Sample
// Checks (or unchecks) the first item. checkbox1.setSelectedIndex(0);
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);
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
setValue( value )
Selects an item which contains the value received as a parameter, and sets the value in the selected item.
For multiple items, use a separator. If there is no item for the given value, no action will occur.
Parameter
nametyperequireddescription
valueStringYValue of the item
Sample
// The component is defined, and Apple and Orange are selected. <xf:select id="checkbox1" appearance="full" style="position: relative;" selectedindex="-1" > <xf:choices> <xf:item> <xf:label><![CDATA[사과]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[체리]]></xf:label> <xf:value><![CDATA[2]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[오렌지]]></xf:label> <xf:value><![CDATA[3]]></xf:value> </xf:item> </xf:choices> </xf:select> checkbox1.setValue("2"); // Cherry will be checked. checkbox1.setValue("0 2"); // Apple and Orange will be checked.
show( displayType )
Displays the component.
The related CSS properties are display and visibility:show;.
Parameter
nametyperequireddescription
displayTypeStringN[default:block ,inline ,none ,""] Value of the Display property.
Sample
// Block the "display" property. componentId.show(); // Enable the "display" property in the class. componentId.show("");
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);
unbindRef( )
Releases the ref binding.
validate( )
Validates the component according to the specified properties.
Validation-related property: mandatory
Return
typedescription
BooleanValidation result
Sample
// All items are unselected. var returnValue = checkbox1.validate(); // (Return Example) false // If the "displaymessage" is "true", the WebSquare5 Engine will alert "Mandatory information" message.
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.)