PropertyEventMethodIndex
WebSquare.uiplugin.mapchart - 5.0_2.2916B.20171222.151448

Visualizes D3 geogrphical data into various types of charts. (Currently supports Korea only.)

Type

uiplugin

Property Summary

dataLists
DataList(s) to bind with the map. Use the comma to separate DataLists.
dataMapPath
Path of the JSON data containing geographical information.
dataMapRatio_level0
[default:simp1] Simplification ratio of the map (at the country level).
dataMapRatio_level1
[default:simp1] Simplification ratio of the map (at the provincial level).
dataMapRatio_level2
[default:simp1] Simplification ratio of the map (at the local level).
event_deselect
[default:onmouseout] Name of the event to display the unselected effects on the event-triggered point.
event_drag
[default:ondrag] Uses the dragging feature on the map. none is not to use the feature.
event_drilldown
[default:onclick] Name of the event to view the details of the event-triggered point.
event_drillup
[default:oncontextmenu] Name of the event that is to move the upper-level map of the current map level.
event_select
[default:onmouseover] Name of the event to display the selected effects on the event-triggered point.
event_tooltipoff
[default:onmouseout] Name of the event to hide the tooltip.
event_tooltipon
[default:onmouseover] Name of the event to show the information of the event-triggered point on a tooltip.
event_zoom
[default:onzoom] Uses the zoom-in/out features on the map.
id
Component ID
setTooltipStrFunc
Name of the function to get the user-defined string to display the tooltip.
startMap
[default:0] Initial map code to render the map.
userData1
User-defined property
userData2
User-defined property
userData3
User-defined property
zoomMax
[default:5] Sets the maximum zoom-in ratio.
zoomMin
[default:0

Event Summary

onaftermapchange
Triggered right after a change is made on the map.
onbeforemapchange
Triggered right before a change is made on the map.
onmapclick
Triggered upon clicking the map.
onmapdatachange
Triggered upon a change in the DataList bound with the map (including initialization, default setting, insertion, and deletion).
onmapdblclick
Triggered upon double-clicking the map
onmapmousemove
Triggered upon the end user's moving the mouse to a certain area of the map
onmapmouseout
Triggered upon the end user's moving out the mouse from a certain area of the map
onmapmouseover
Triggered upon the end user's hovering the mouse over a certain area of the map

Method Summary

addClass( className )
Adds a class to the component.
addMapEvent( evName , func )
Adds events to the map.
addPattern( patternData )
A function to add a pattern to SVG.
bind( eventType , function )
Dynamically allocates events to the component.
changeClass( oldClassName , newClassName )
Renames the class from oldClassName to newClassName.
changeMap( code )
Changes the map based on the reeived code.
changeMapPath( mapPath )
Changes the path of the map data.
createPattern( userPatternData , useDefaultPattern )
drillup( )
Changes to draw the parent map of the current map.
focus( )
Moves the focus to the component.
getCurrentMap( )
Gets the code of the currently rendered map.
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.
getInitStyle( property )
Gets the initial style of the component.
getOpacity( )
Gets the opacity of the component defined in CSS.
getParentMap( )
Gets the code of the parent map.
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.
getScope( )
Returns the parent WFrame object when the component is a child of the WFrame which uses the scope feature (scope=true).
getScopeWindow( )
Returns the scope object of the parent when the component is a child of the WFrame which uses the scope feature (scope=true).
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.
getUdcHome( )
Returns the path of the file which defines the UDC.
getUdcRoot( )
Returns the path of the file which defines the UDC.
getUserData( key )
Returns the user-defined property value set by setUserData as the user data or source (page XML).
hasClass( className )
Checks whether the component has className received as a parameter or not.
hide( )
Hides the component.
removeClass( className )
Removes className from the component.
setDisabled( disabled )
Sets the disabled property.
setEventPause( evList , flag )
Disables or enables the component event.
setInitStyle( property )
Initializes the component style.
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.
setScale( scale )
Sets the map scale.
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.
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.
visible( flag )
[deprecated] Shows/Hides the component, or sets the visible property using setStyle.

Property Detail

dataLists
DataList(s) to bind with the map. Use the comma to separate DataLists.
dataMapPath
Path of the JSON data containing geographical information. The default is externalJS/mapchart.
dataMapRatio_level0
(simp1 (default): Visvalingam, weighted area 1%. simp01: Visvalingam, weighted area 0.1%. simp16: Douglas-Peucker 16%.)
dataMapRatio_level1
(simp1 (Default): Visvalingam, weighted area 1%. simp008: Visvalingam-effective Area 0.08%. simp16: Douglas-Peucker 16%.)
dataMapRatio_level2
(simp1 (Default): Visvalingam, weighted area 1%. simp008: Visvalingam-effective Area 0.08%. simp16: Douglas-Peucker 16%.)
event_deselect
[default: onmouseout] Name of the event to display the unselected effects on the event-triggered point. Not to specify such an event, input none.
event_drag
[default: ondrag] Uses the dragging feature on the map. none is not to use the feature.
event_drilldown
[default:onclick] Name of the event to view the details of the event-triggered point. Not to specify such an event, input none.
event_drillup
[default:oncontextmenu] Name of the event that is to move the upper-level map of the current map level. Not to specify such an event, input none.
event_select
[default:onmouseover] Name of the event to display the selected effects on the event-triggered point. Not to specify such an event, input none.
event_tooltipoff
[default:onmouseout] Name of the event to hide the tooltip. Not to specify such an event, input none.
event_tooltipon
[default:onmouseover] Name of the event to show the information of the event-triggered point on a tooltip. Not to specify such an event, input none.
event_zoom
[default:onzoom] Uses the zoom-in/out features on the map. none is not to use the zoom features.
id
Component ID
setTooltipStrFunc
Name of the function to get the user-defined string to display the tooltip.
startMap
[default:0] Initial map code to render the map. The default is 0 for the entire country. (Example: 11 is for Seoul.)
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.
zoomMax
[default:5] Sets the maximum zoom-in ratio.
zoomMin
[default:0.2] Sets the minimum zoom-in ratio.

Event Detail

onaftermapchange
Triggered right after a change is made on the map. Also triggered upon initial execution.
Sample
<script ev:event="onafterchange()"><![CDATA[ alert(this.getCurrentMap() + "," + this.getParentMap()); ]]></script>
onbeforemapchange
Triggered right before a change is made on the map. Event handler function's returning false will cancel the change.
Parameter
nametypedescription
infoJSONReturns JSON data containing oldMapCode, and newMapCode. <String> info.oldMapCode : Map code right before the change (Currently rendered map) <String> info.newMapCode : New map code to change
Sample
<script ev:event="onbeforemapchange( info )"><![CDATA[ if( info.newMapCode.length >= 5) { return false; // 변경되고자 하는 지도가 2단계 이하 단계인 경우 지도 변경 동작을 취소한다. 즉 지도의 최대 depth를 1단계(전국 - 시,도 범위까지)까지만 허용한다. } ]]></script>
onmapclick
Triggered upon clicking the map.
Parameter
nametypedescription
propertiesJSONeturns JSON data containing code, name, name_eng, and base_year. <String> properties.code : Local code <String> properties.name : Name of the place (in Korean) <String> properties.name_eng : Name of the place (in English) <String> properties.base_year : Map data date
Sample
<script ev:event="onmapclick( properties )"><![CDATA[ if( properties.code.length === 5) { this.changeMap(properties.code); } ]]></script>
onmapdatachange
Triggered upon a change in the DataList bound with the map (including initialization, default setting, insertion, and deletion).
Sample
<script ev:event="onmapdatachange(dataListId)"><![CDATA[ switch(dataListId) { case "dataList_mapchart_color" : scwin.updateMapchartColor(dataListId); break; case "dataList_mapchart_flag1" : scwin.updataeMapchartFlag(dataListId); break; } ]]></script>
onmapdblclick
Triggered upon double-clicking the map
Parameter
nametypedescription
propertiesJSONeturns JSON data containing code, name, name_eng, and base_year. <String> properties.code : Local code <String> properties.name : Name of the place (in Korean) <String> properties.name_eng : Name of the place (in English) <String> properties.base_year : Map data date
Sample
<script ev:event="onmapdblclick( properties )"><![CDATA[ if( properties.code.length === 5) { this.changeMap(properties.code); } ]]></script>
onmapmousemove
Triggered upon the end user's moving the mouse to a certain area of the map
Parameter
nametypedescription
propertiesJSONeturns JSON data containing code, name, name_eng, and base_year. <String> properties.code : Local code <String> properties.name : Name of the place (in Korean) <String> properties.name_eng : Name of the place (in English) <String> properties.base_year : Map data date
Sample
<script ev:event="onmapmousemove( properties )"><![CDATA[ if( properties.code.length === 5) { this.changeMap(properties.code); } ]]></script>
onmapmouseout
Triggered upon the end user's moving out the mouse from a certain area of the map
Parameter
nametypedescription
propertiesJSONeturns JSON data containing code, name, name_eng, and base_year. <String> properties.code : Local code <String> properties.name : Name of the place (in Korean) <String> properties.name_eng : Name of the place (in English) <String> properties.base_year : Map data date
Sample
<script ev:event="onmapmouseout( properties )"><![CDATA[ if( properties.code.length === 5) { this.changeMap(properties.code); } ]]></script>
onmapmouseover
Triggered upon the end user's hovering the mouse over a certain area of the map
Parameter
nametypedescription
propertiesJSONeturns JSON data containing code, name, name_eng, and base_year. <String> properties.code : Local code <String> properties.name : Name of the place (in Korean) <String> properties.name_eng : Name of the place (in English) <String> properties.base_year : Map data date
Sample
<script ev:event="onmapmouseover( properties )"><![CDATA[ if( properties.code.length === 5) { this.changeMap(properties.code); } ]]></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");
addMapEvent( evName , func )
Adds events to the map. The event must be supported by D3.
Parameter
nametyperequireddescription
evNameStringYName of the event
funcfuncYEvent handler function
Sample
mapchart1.addMapEvent("onkeydown", scwin.mapchart1_onkeydown);
addPattern( patternData )
A function to add a pattern to SVG.
Parameter
nametyperequireddescription
patternDataobjectYJSON object containing pattern information
Sample
var pattern = {"type":"line", "size":4, "stroke":"#BDBDBD", "strokeWidth":1}; mapchart1.addPattern(pattern);
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");
changeMap( code )
Changes the map based on the reeived code.
Parameter
nametyperequireddescription
codeStringYNew map code
Sample
mapchart1.changeMap("11"); // Change the map into the map of code 11.
changeMapPath( mapPath )
Changes the path of the map data.
Parameter
nametyperequireddescription
mapPathStringYNew path
Sample
mapchart1.changeMapPath("mapdata/2016"); // Change the path to mapdata/2016 directory. The map data under this path will be rendered as a map.
createPattern( userPatternData , useDefaultPattern )
Parameter
nametyperequireddescription
userPatternDataobjectYArray of JSON objects containing pattern data
useDefaultPatternbooleanNUse of the patterns in the component
Sample
var patternArray = [{"type":"line", "size":4, "stroke":"#BDBDBD", "strokeWidth":1}]; mapchart1.createPattern(patternArray);
drillup( )
Changes to draw the parent map of the current map. Does not function when the current map is of the highest level (a country map).
Sample
mapchart1.drillup();
focus( )
Moves the focus to the component.
getCurrentMap( )
Gets the code of the currently rendered map.
Return
typedescription
StringCode of the currently rendered map
Sample
var currentMap = mapchart1.getCurrentMap(); if(currentMap.length === 5) { mapchart1.changeMap(currentMap.slice(0,2)); } // Draw the higher-level map of the current map.
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" }
getInitStyle( property )
Gets the initial style of the component.
Parameter
nametyperequireddescription
propertyStringNName of the attribute (If not specified, all information will be ouputted.)
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"
getParentMap( )
Gets the code of the parent map.
Return
typedescription
StringCode of the parent map
Sample
The following two have the same effect.
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
getScope( )
Returns the parent WFrame object when the component is a child of the WFrame which uses the scope feature (scope=true).
Returns null when the component is not a child of the WFrame using the scope feature (scope=true).
Return
typedescription
Objectwframe object or null
Sample
// The main page contains wframe1, and wframe1 contains wframe11 which contains textbox1. textbox1.getScope(); // Returns wframe11 object.
getScopeWindow( )
Returns the scope object of the parent when the component is a child of the WFrame which uses the scope feature (scope=true).
Returns a global window object when the component is not a child of the WFrame using the scope feature (scope=true.
Return
typedescription
ObjectScope object of the wframe object, or a global window object
Sample
// The main page contains wframe1, and wframe1 contains wframe11 which contains textbox1. var scope = textbox1.getScopeWindow(); scope.wframe11 === textbox1.getScope(); // true
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"
getUdcHome( )
Returns the path of the file which defines the UDC. Includes the file extension of .xml. For a path without .xml, use getUdcRoot. When called by a component, not a UDC object, undefined will be returned.
Return
typedescription
StringWhen called by a component, not a UDC object, undefined will be returned.
Sample
The udc file is /a/b/udc.xml, the XML file is /a/c/main.xml, and the UDC object ID is udc1. udc1.getUdcHome(); // The execution result is /a/b/udc.xml.
getUdcRoot( )
Returns the path of the file which defines the UDC. udc1.getUdcHome(); // The execution result is /a/b/udc.xml. For a path including .xml, use getUdcHome. When called by a component, not a UDC object, undefined will be returned.
Return
typedescription
StringWhen called by a component, not a UDC object, undefined will be returned.
Sample
The udc file is /a/b/udc.xml, the XML file is /a/c/main.xml, and the UDC object ID is udc1. udc1.getUdcHome(); // The execution result is /a/b/udc.xml.
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"
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();
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");
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.
setInitStyle( property )
Initializes the component style.
Parameter
nametyperequireddescription
propertyStringNName of the property (If not specified, all properties will be returned.)
Sample
group1.getInitStyle();
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);
setScale( scale )
Sets the map scale.
Parameter
nametyperequireddescription
scaleFloatYSets the map scale.
Sample
mapchart1.setScale(0.8) // Set the map scale to 0.8.
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
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);
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.)