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

Functions same as the radio input type in the HTML. Provides user interfaces to select an item.
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.
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
Tag name of the item when the renderType is radiogroup.
mandatory
[default:false, true] Whether to check the mandatory input or not when calling the validation API.
name
Name of the group. Same as the name property in HTML.
ref
The value of the DataCollection. Required to bind the component with a DataCollection. Starts with a prefix of "data:".
renderType
[default:table, native, radiogroup] Layout structure of the Radio component. For the details, see the below.
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.
tabIndex
Same as the tabindex property in HTML standard. Indicates the focusing order of the component by the tab key.
tagname
Tag name of the object to be rendered when the renderType is radiogroup.
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.
useLocale
[default:false, true] True to use the multi-language key to display the labels on the WebSquare5 client.
useRadioTitle
[default:true, false] Shows the title on the radio item (or button) to comply with web accessibility requirements.
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.
onlabelclick
Triggered upon clicking of the label. Not triggered by clicking of the radio button.
onradioclick
Triggered upon clicking of the raido button. Not triggered by clicking of the label.
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.
click( index )
Delivers same effects as when an item of the corresponding index is clicked. Triggers an event related to clicking.
deleteItem( index )
Deletes the item of the corresponding index.
focus( )
Moves the focus to the 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( )
Returns the index of the selected item.
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( )
Returns the label of the selected item.
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( )
Returns the value of the selected item.
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( )
Unselects the item.
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 )
Selects an 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.
setTitle( title )
Sets the title of the component.
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.
validateObject( )
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.
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
Tag name of the item when the renderType is radiogroup.
mandatory
[default:false, true] Whether to check the mandatory input or not when calling the validation API.
name
Name of the group. Same as the name property in HTML.
If not specified, a name will be automatically given by the WebSquare5 Engine.
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, radiogroup] Layout structure of the Radio component. For the details, see the below.
table : Uses table tag under div tag, not input tag.
native : Creates only <input type="radio">. The developer must create a label tag using the TextBox component. In case no title is defined, the label must be created (for web accessibility compliance).
radiogroup : 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.
tabIndex
Same as the tabindex property in HTML standard. Indicates the focusing order of the component by the tab key.
tagname
Tag name of the object to be rendered when the renderType is radiogroup.
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.다.
useLocale
[default:false, true] True to use the multi-language key to display the labels on the WebSquare5 client.
useRadioTitle
[default:true, false] Shows the title on the radio item (or button) to comply with web accessibility requirements.
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();
onlabelclick
Triggered upon clicking of the label. Not triggered by clicking of the radio button.
The event handler (this function) can access the component. (Example) this.getValue();
Parameter
nametypedescription
indexString:YIndex of the triggered item
valueString:YValue of the triggered item
Sample
<script ev:event="onlabelclick( index, value )"><![CDATA[ var itemIndex = index; //item의 index var itemValue = value; //item의 value var compValue = this.getValue(); //컴포넌트의 value ]]></script>
onradioclick
Triggered upon clicking of the raido button. Not triggered by clicking of the label.
The event handler (this function) can access the component. (Example) this.getValue();
Parameter
nametypedescription
indexString:YIndex of the triggered item
valueString:YValue of the triggered item
Sample
<script ev:event="onradioclick( index, value )"><![CDATA[ var itemIndex = index; //item의 index 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 and value. <Number> info.index : Index 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 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
indexNumberYIndex of the item
Return
typedescription
NumberIndex of the added item
Sample
// The Radio is defined as shown below. <xf:select1 id="radio1" selectedIndex="-1" appearance="full" style="position: relative;"> <xf:choices> <xf:item> <xf:label><![CDATA[자택]]></xf:label> <xf:value><![CDATA[0]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[직장]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> </xf:choices> </xf:select1> var returnValue = radio1.addItem( '3', 'Others' ); // (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");
click( index )
Delievers same efffects as when an item of the corresponding index is clicked. Triggers an event related to clicking.
Parameter
nametyperequireddescription
indexNumberYIndex of the item to trigger a click event
Sample
// Trigger a click event for the first item. radio1.click(0);
deleteItem( index )
Deletes the item of the corresponding index.
Parameter
nametyperequireddescription
indexNumberYIndex 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
// The Radio is defined as shown below. <xf:select1 id="radio1" selectedIndex="-1" appearance="full" style="position: relative;"> <xf:choices> <xf:item> <xf:label><![CDATA[자택]]></xf:label> <xf:value><![CDATA[0]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[직장]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> </xf:choices> </xf:select1> var returnValue = radio1.deleteItem(0); // (Return) {label: "Home", value: "0"}
focus( )
Moves the focus to the component.
Sample
radio1.focus();
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 = radio1.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 = radio1.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( )
Returns the index of the selected item.
Return
typedescription
NumberIndex of the selected item
Sample
// When the first item is selected, var returnValue = radio1.getSelectedIndex(); // (Return Example) 0
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( )
Returns the label of the selected item.
Return
typedescription
StringLabel of the selected item
Sample
// Define a Radio and select Home. <xf:select1 id="radio1" selectedIndex="-1" appearance="full" style="position: relative;"> <xf:choices> <xf:item> <xf:label><![CDATA[자택]]></xf:label> <xf:value><![CDATA[0]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[직장]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> </xf:choices> </xf:select1> var returnValue = radio1.getText(); // (Return) "Home"
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( )
Returns the value of the selected item.
Return
typedescription
StringValue of the selected item
Sample
// Define a Radio and select Home. <xf:select1 id="radio1" selectedIndex="-1" appearance="full" style="position: relative;"> <xf:choices> <xf:item> <xf:label><![CDATA[자택]]></xf:label> <xf:value><![CDATA[0]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[직장]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> </xf:choices> </xf:select1> var returnValue = radio1.getValue(); // (Return) "0"
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
radio1.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( )
Unselects the item.
Sample
// Unselect. radio1.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. radio1.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[남성]]></lbl> <code><![CDATA[M]]></code> </w2:row> <w2:row> <lbl><![CDATA[여성]]></lbl> <code><![CDATA[F]]></code> </w2:row> </w2:data> </w2:dataList> // Change the itemset of component radio1 to dataList1 of DataCollection, and set the label as lbl column and the value as code column. radio1.setNodeSet('data:dataList1','lbl','code'); // Change to dataList2 which has same columns with dataList1 but different data. radio1.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 gender key of dataMap1 with the value of component radio1. radio1.setRef("data:dataMap1.gender"); // Bind with res/userData/gender of the InstanceData. radio1.setRef("res/userData/gender");
setSelectedIndex( index )
Selects an item of the corresponding index.
Parameter
nametyperequireddescription
indexNumberYIndex of the item
Sample
// Select the first item. radio1.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");
setTitle( title )
Sets the title of the component.
Parameter
nametyperequireddescription
titleStringYProperty value
Sample
radio1.setTitle("test"); // Set the title property of radio1 as "test".
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.
In case there is no item of the corresponding value, no operation will be made.
Parameter
nametyperequireddescription
valueStringYValue of the item
Sample
// The Radio is defined as shown below. <xf:select1 id="radio1" selectedIndex="-1" appearance="full" style="position: relative;"> <xf:choices> <xf:item> <xf:label><![CDATA[남성]]></xf:label> <xf:value><![CDATA[M]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[여성]]></xf:label> <xf:value><![CDATA[F]]></xf:value> </xf:item> </xf:choices> </xf:select1> radio1.setValue("M"); // “Male” will be selected.
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
validateObject( )
Validates the component according to the specified properties.
Related Properties : mandatory, minLength, maxLength, minByteLength, maxByteLength
(Version: Added in 5.0_1.2783B.20170908.145609.)
Return
typedescription
Objectobject validation result object
<String> object.callerId Validation target component ID <String> object.type Validation items <Boolean> object.value Validation result
Sample
// Set the mandatory property in the Radio as shown below. <xf:select1 appearance="full" id="radio1" style="position: absolute;width:257px;height:78px;left:888px;top:458px;" mandatory="true"> <xf:choices> <xf:itemset nodeset="data:dataList3"> <xf:label ref="label"></xf:label> <xf:value ref="value"></xf:value> </xf:itemset> </xf:choices> </xf:select1> var returnObj = radio.validateObject(); // Return - without Radio value) An empty object will be returned. // Return - with Radio) returnObj will be returned. returnObj.callerId = "radio" returnObj.type = "mandatory" returnObj.value = "" Alerts the defined message upon a validation failure when the displaymessage is "true". // (Alert Example) This field is mandatory.
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.)