PropertyEventMethod찾아보기
WebSquare.uiplugin.generator - 5.0_1.3521B.20190311.114514

특정 영역이 반복되어 표현되거나 동일한 영역을 동적으로 추가/삭제해야 할 때 사용하는 컴포넌트이다.
본 컴포넌트의 안쪽(하위)에 정의된 영역이 반복이 되며 script를 통해 제어한다.
주사용 용도로는 일정 관리용 캘린더, 메뉴, 설문지 등이 있다.
컴포넌트의 하위에 사용할 수 없는 컴포넌트 목록 : Chart, GridView, Menu, Switch, TabControl, Treeview, WindowContainer, Grid, TabContainer
대표적인 주의 사항은 아래와 같다.
기본적으로 웹스퀘어 컴포넌트는 초기에 설정한 ID로 접근이 가능하지만 본 컴포넌트의 하위에 정의된 자식 컴포넌트들은 초기에 설정한 ID로 접근이 불가능하다.
동적으로 자식 컴포넌트가 추가됨에 엔진에서 ID가 중복되지 않도록 초기에 설정한 ID를 기반으로 재설정하기 때문이다.
따라서 개발자는 자식 컴포넌트에 접근할 때 본 컴포넌트에서 제공하는 API를 통해 접근해야한다.
반복부에 속해 있는 컴포넌트들은 모두 나의 반복부 index와 같은 반복부에 속해있는 다른 컴포넌트를 반환하는 API를 제공한다.
주의 사항은 위에 설명한 대로 this로 접근하여 API를 호출한다.
- 반복부의 index를 반환하는 API 예시 ) var tmpIdx = this.getGeneratedIndex();
- 동일 반복부에 있는 다른 컴포넌트에 접근 하는 API 예시 ) var tmpObj = this.getGeneratedComponent("input1"); //동일 반복부의 input1객체 반환
본 컴포넌트의 최상위는 HTML div Tag로 표현되며 tagname속성을 통해 다른 HTML Tag로 변경할 수 있다.

Type

uiplugin

Property Summary

class
HTML의 class속성과 동일한 기능을 제공하며 css파일 또는 style블럭에 정의한 class를 1개 또는 공백(space)를 이용하여 다중 적용이 가능하다.
id
컴포넌트의 ID로 전역객체로 할당되며 script에서 본 id로 컴포넌트에 접근이 가능하다
tagname
기본적으로 div Tag로 표현되며 div가 아닌 다른 Tag로 표현하고자 할 때 사용한다.
userData1
사용자 정의 데이터 속성
userData2
사용자 정의 데이터 속성
userData3
사용자 정의 데이터 속성

Event Summary

Method Summary

addClass( className )
컴포넌트에 class를 추가한다
bind( eventType , function )
컴포넌트의 이벤트를 동적으로 할당한다
changeClass( oldClassName , newClassName )
컴포넌트에서 oldClassName의 이름을 가진 class를 newClassName으로 변경한다.
focus( )
컴포넌트에 focus를 준다
getChild( index , id )
컴포넌트의 ID와 해당 컴포넌트가 속해 있는 반복부의 index를 기반으로 컴포넌트 객체를 반환한다
getDisabled( )
현재 설정되어있는 disabled 속성값을 반환한다
getGenerator( )
generator 하위의 컴포넌트에서 이 함수를 호출하여 자신을 생성한 부모 generator 객체를 가져온다
getID( )
웹스퀘어 컴포넌트의 id를 반환한다
getLength( )
반복부의 개수를 반환한다
getOpacity( )
CSS로 정의 된 컴포넌트의 Opacity(불투명도) 값을 반환한다
getPluginName( )
웹스퀘어 컴포넌트의 pluginName(컴포넌트명)을 반환한다
getPosition( positionName )
컴포넌트의 left 또는 top의 위치 값을 반환한다
getReadOnly( )
현재 설정되어있는 readOnly 속성값을 반환한다
getSize( sizeName )
컴포넌트의 크기 값을 반환합니다
getStyle( propertyName )
컴포넌트에 적용 된 CSS의 propertyName에 해당하는 값을 반환한다
getStyleValue( style )
[deprecated]getStyle로 사용.
getTitle( )
title 속성값을 반환한다
getUserData( key )
setUserData API로 설정 된 사용자 데이터 또는 소스(화면 XML)에 사용자가 임의의 property로 정의 된 값을 반환한다
hasClass( className )
컴포넌트가 parameter로 받은 className의 class를 가지고 있는지의 여부를 반환한다
hide( )
컴포넌트를 화면에서 보이지 않도록 숨긴다.
insertChild( index )
index에 해당하는 위치에 반복부를 삽입한다
removeAll( )
모든 반복부를 삭제한다
removeChild( index )
index에 해당하는 반복부를 삭제하며 index가 없을 경우 마지막 반복부를 삭제힌다
removeClass( className )
컴포넌트에 className의 class를 삭제한다.
setDisabled( disabled )
컴포넌트의 disabled 속성을 설정한다
setEventPause( evList , flag )
컴포넌트의 이벤트를 disable 또는 enable시킨다
setOpacity( value )
컴포넌트의 CSS Opacity(불투명도)값를 설정한다
setPosition( left , top , mode )
컴포넌트의 위치(left,top)를 설정한다
setReadOnly( readOnly )
readOnly 속성값을 설정한다
setSize( width , heigth )
컴포넌트의 크기(width,height)를 설정한다
setStyle( propertyName , value )
컴포넌트의 propertyName에 해당하는 style의 값을 설정합니다
setUserData( key , value )
컴포넌트에 사용자 데이터를 설정한다
show( displayType )
컴포넌트를 화면에 보이도록 설정한다.
toggleClass( className )
컴포넌트가 className의 이름을 가진 class를 가지고 있다면 제거하고, 가지고 있지 않다면 추가한다.
trigger( type , array )
컴포넌트에 등록 된 특정 이벤트를 발생시킨다
unbind( type , function )
컴포넌트에 등록 된 이벤트를 제거한다
visible( flag )
[deprecated]show/hide 로 사용하거나 setStyle을 통해 visible 속성을 설정한다.

Property Detail

class
HTML의 class속성과 동일한 기능을 제공하며 css파일 또는 style블럭에 정의한 class를 1개 또는 공백(space)를 이용하여 다중 적용이 가능하다.
기본적으로 엔진 내부에서 컴포넌트별로 class를 적용하고 있으며 해당 class를 이용하여 컴포넌트의 css를 공통으로 적용할 수 있다.
id
컴포넌트의 ID로 전역객체로 할당되며 script에서 본 id로 컴포넌트에 접근이 가능하다.
tagname
기본적으로 div Tag로 표현되며 div가 아닌 다른 Tag로 표현하고자 할 때 사용한다.
일반적으로 자식 Tag(Element)를 가질 수 있는 Tag를 정의한다.
userData1
사용자 정의 데이터 속성. getUserData("userData1") API를 통해 설정한 값을 얻어올 수 있다.
userData2
사용자 정의 데이터 속성. getUserData("userData2") API를 통해 설정한 값을 얻어올 수 있다.
userData3
사용자 정의 데이터 속성. getUserData("userData3") API를 통해 설정한 값을 얻어올 수 있다.

Event Detail

Method Detail

addClass( className )
컴포넌트에 class를 추가한다.
Parameter
nametyperequireddescription
classNameStringY추가하고 싶은 class의 이름
Sample
//input1 컴포넌트에 oddClass 라는 class를 추가 할 때 input1.addClass("oddClass");
bind( eventType , function )
컴포넌트의 이벤트를 동적으로 할당한다.
Parameter
nametyperequireddescription
eventTypeStringY할당 할 이벤트명.
functionFunctionY동적으로 할당 할 이벤트의 핸들러 function.
Sample
//input1에 onclick 이벤트에 핸들러 function을 직접 정의하여 bind. input1.bind("onclick", function(e){ alert(input1.getValue();})); //input1에 onclick 이벤트에 미리 정의 한 commObj.ev_click function을 bind. var commObj = {}; commObj.ev_click = function(e){ alert("click :: "+this.id); }; input1.bind("onclick", commObj.ev_click );
changeClass( oldClassName , newClassName )
컴포넌트에서 oldClassName의 이름을 가진 class를 newClassName으로 변경한다.
기본 설정은 addClass API를 통해 추가 된 class만 적용되며 컴포넌트의 class 속성에 직접 정의 된 class를 삭제해야하는 경우는 config.xml파일의 설정을 아래와 같이 적용해야한다.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
oldClassNameStringY삭제 할 class의 이름
newClassNameStringY추가 할 class의 이름
Sample
//아래와 같이 input 컴포넌트에 class를 정의 한 경우 <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> //config.xml 파일에 아래와 같이 정의. <style> <removeDefaultClass value="true" /> </style> //tmpInputClass class를 tmpInputWarninClass로 변경 input1.changeClass("tmpInputClass","tmpInputWarninClass");
focus( )
컴포넌트에 focus를 준다.
getChild( index , id )
컴포넌트의 ID와 해당 컴포넌트가 속해 있는 반복부의 index를 기반으로 컴포넌트 객체를 반환한다.
Parameter
nametyperequireddescription
indexNumberY반환 받을 컴포넌트가 속해 있는 반복부의 index.(보이는 순서대로)
idStringY반환 받을 컴포넌트의 초기 설정 ID.
Return
typedescription
Object반복부에서 찾아진 웹스퀘어 컴포넌트
Sample
//아래와 같이 generator를 정의. (input과 trigger가 있는 group이 반복부에 속한다) <w2:generator id="generator1" style="position: relative;"> <xf:group id="group1" style="position: relative;padding:10px;" class=""> <xf:input id="input1" style="position: relative;width: 144px;height: 21px;margin-right:10px;"> </xf:input> <xf:trigger type="button" id="trigger1" style="position: relative;width: 80px;height: 23px;"> <xf:label><![CDATA[getValue]]></xf:label> </xf:trigger> </xf:group> </w2:generator> //4개의 배열 데이터를 기반으로 반복부를 생성하고 input컴포넌트의 value를 변경하고자 할 때의 script 작성 예시 var tmpArr = ["손예진","이광수","이선희","류승룡"]; //배열 데이터 //상단에 정의 된 배열의 개수만큼 반복부 추가 for(var i=0;i<tmpArr.length;i++){ //반복부 추가 generator1.insertChild(i); //추가 된 반복부에서 input1 컴포넌트 객체 꺼내오기 var tmpChild = generator1.getChild( i , "input1" ); //input의 value를 배열데이터의 i번쨰 값으로 설정 tmpChild.setValue(tmpArr[i]); }
getDisabled( )
현재 설정되어있는 disabled 속성값을 반환한다.
Return
typedescription
Booleandisabled 속성값
Sample
var returnValue = componentId.getDisabled(); return 예시 ) false
getGenerator( )
generator 하위의 컴포넌트에서 이 함수를 호출하여 자신을 생성한 부모 generator 객체를 가져온다.
Return
typedescription
Object부모 generator 객체
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());} // trigger1 클릭 시 generator1 객체가 console에 찍힌다. // https://inswave.com/jira/browse/WPF-1425 참조
getID( )
웹스퀘어 컴포넌트의 id를 반환한다.
Return
typedescription
String웹스퀘어 컴포넌트의 id
Sample
//동적으로 웹스퀘어 컴포넌트를 파라메터로 받았을 경우 아래와 같이 사용 할 수 있다. function fn_validCheck(tmpObj){ //tmpObj가 input1 이라는 ID를 가지고 있는 경우 var compID = tmpObj.getID(); //return 예시 ) "input1" }
getLength( )
반복부의 개수를 반환한다.
Return
typedescription
Number반복부의 개수
getOpacity( )
CSS로 정의 된 컴포넌트의 Opacity(불투명도) 값을 반환한다.
Return
typedescription
IntegerOpacity 값
Sample
//아래와 같이 input 컴포넌트에 opcacity css를 적용 한 경우 <xf:input id="input1" style="position: relative;width: 144px;height: 21px;opacity:0.2;"></xf:input> var returnValue = input1.getOpacity(); // returnValue는 0~1사이의 실수이다. //return 예시 ) "0.2"
getPluginName( )
웹스퀘어 컴포넌트의 pluginName(컴포넌트명)을 반환한다.
Return
typedescription
String웹스퀘어 컴포넌트의 pluginName
Sample
//아래와 같이 공통 function에서 동적으로 웹스퀘어 객체를 받았을 때 컴포넌트의 종류에 따른 분기처리를 할수 있다. var commObj = {}; commObj.fn_makeReqData = function(tmpObj){ var tmpID = tmpObj.getID(); //컴포넌트 ID var tmpCompType = tmpObj.getPluginName(); //컴포넌트 종류 if(tmpCompType == "input"){ //..로직.. }else if(tmpCompType == "gridView"){ //..로직 .. }else{ //..로직.. } };
getPosition( positionName )
컴포넌트의 left 또는 top의 위치 값을 반환한다. %로 설정된 경우, 픽셀로 변환하여 반환한다.
Parameter
nametyperequireddescription
positionNameStringY[left,top]위치 종류
Return
typedescription
Number컴포넌트의 위치 값
Sample
//아래와 같이 input 컴포넌트에 margin css를 적용했을 경우 <xf:input id="input1" style="position: relative;width: 144px;height: 21px;margin:10px;"></xf:input> var returnValue = input1.getPosition("top"); // returnValue는 픽셀 단위의 위치 값이다. //return 예시 ) 10
getReadOnly( )
현재 설정되어있는 readOnly 속성값을 반환한다.
Return
typedescription
Boolean현재 설정되어있는 readOnly 속성
Sample
var returnValue = componentId.getReadOnly(); //return 예시 ) false
getSize( sizeName )
컴포넌트의 크기 값을 반환합니다.%로 설정된 경우, 픽셀로 변환하여 반환한다.
Parameter
nametyperequireddescription
sizeNameStringY[height,innerHeight,outerHeight,outerMarginHeight,width,innerWidth,outerWidth,outerMarginWidth]크기 값의 종류. szieName별 계산 방법은 아래를 참고.
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
Number컴포넌트의 크기 값
Sample
var returnValue = componentId.getSize("width"); // returnValue는 픽셀 단위의 크기 값이다. %로 설정된 경우, 픽셀로 변환하여 반환한다. //return 예시 ) 100
getStyle( propertyName )
컴포넌트에 적용 된 CSS의 propertyName에 해당하는 값을 반환한다.
Parameter
nametyperequireddescription
propertyNameStringY반환 할 style의 property 이름
Return
typedescription
Stringstyle의 속성값
Sample
//아래와 같이 input 컴포넌트가 정의 된 경우 <xf:input id="input1" style="position: relative;width: 144px;height: 21px;"></xf:input> var returnValue = input1.getStyle("width"); //return 예시 ) "144px"
getStyleValue( style )
[deprecated]getStyle로 사용.
컴포넌트에 적용 된 CSS의 propertyName에 해당하는 값을 반환한다.
Parameter
nametyperequireddescription
styleStringY정의 된 style에서 사용자가 반환 받고자하는 속성명.
Return
typedescription
Stringstyle 속성에 정의 된 값(색을 반환하는 경우에는 색HexCode로 반환)
getTitle( )
title 속성값을 반환한다.
Return
typedescription
Stringtitle 속성값.
Sample
//아래와 같이 input 컴포넌트에 title이 정의 된 경우 <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" title="이름 입력"></xf:input> var tmpTitle = input1.getTitle(); //return 예시 ) "이름 입력"
getUserData( key )
setUserData API로 설정 된 사용자 데이터 또는 소스(화면 XML)에 사용자가 임의의 property로 정의 된 값을 반환한다.
Parameter
nametyperequireddescription
keyStringY임의 데이터의 키
Return
typedescription
Stringkey에 해당하는 데이터
Sample
//아래와 같이 input 컴포넌트의 사용자 속성(eduTest)이 적용 된 경우. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" eduTest="Hello"></xf:input> input1.getUserData("eduTest"); //return 예시 ) "Hello" //setUserData를 통해 set한 경우 input1.setUserData("eduTest","WebSquare"); input1.getUserData("WebSquare"); //return 예시 ) "Hello"
hasClass( className )
컴포넌트가 parameter로 받은 className의 class를 가지고 있는지의 여부를 반환한다.
Parameter
nametyperequireddescription
classNameStringY검색 할 className
Return
typedescription
Booleanclass를 가지고 있는지의 여부
Sample
//아래와 같이 input 컴포넌트에 class가 정의 된 경우 <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> var returnValue = input1.hasClass("tmpInputClass"); //return 예시 ) true
hide( )
컴포넌트를 화면에서 보이지 않도록 숨긴다.
엔진 내부적으로는 CSS를 display:none;과 visibility:hidden;으로 처리한다.
Sample
componentId.hide();
insertChild( index )
index에 해당하는 위치에 반복부를 삽입한다. index가 생략 된 경우 마지막에 삽입된다.
Parameter
nametyperequireddescription
indexNumberN반복부를 삽입할 위치
Return
typedescription
Number반복부가 생성된 순서의 번호로 index와 다르다.
Sample
//아래와 같이 generator를 정의. (input과 trigger가 있는 group이 반복부에 속한다) <w2:generator id="generator1" style="position: relative;"> <xf:group id="group1" style="position: relative;padding:10px;" class=""> <xf:input id="input1" style="position: relative;width: 144px;height: 21px;margin-right:10px;"> </xf:input> <xf:trigger type="button" id="trigger1" style="position: relative;width: 80px;height: 23px;"> <xf:label><![CDATA[getValue]]></xf:label> </xf:trigger> </xf:group> </w2:generator> //0번째 index에 반복부를 삽입한다. - 1번째 위치에 삽입 generator1.insertChild(0); //마지막에 반복부를 삽입한다. - 2번째 위치에 삽입 generator1.insertChild();
removeAll( )
모든 반복부를 삭제한다.
removeChild( index )
index에 해당하는 반복부를 삭제하며 index가 없을 경우 마지막 반복부를 삭제힌다.
Parameter
nametyperequireddescription
indexNumberN삭제할 반복부의 index
Return
typedescription
Number삭제된 반복부의 생성 번호(index가 아님)가 담긴 배열.
Sample
//아래와 같이 generator를 정의. //반복부의 trigger1 컴포넌트를 click할 때 click된 반복부를 삭제하는 로직을 구현. <w2:generator id="generator1" style="position: relative;"> <xf:group id="group1" style="position: relative;padding:10px;" class=""> <xf:input id="input1" style="position: relative;width: 144px;height: 21px;margin-right:10px;"> </xf:input> <xf:trigger type="button" id="trigger1" style="position: relative;width: 80px;height: 23px;"> <xf:label><![CDATA[delete]]></xf:label> <script ev:event="onclick(e)" type="javascript"><![CDATA[ var tmpIdx = this.getGeneratedIndex(); //현재 반복된 index 꺼내오기.(동적으로 trigger가 생성 됨으로 this로 접근해야한다.) generator1.removeChild( tmpIdx ); //tmpIdx를 기반으로 반복구 삭제 ]]></script> </xf:trigger> </xf:group> </w2:generator>
removeClass( className )
컴포넌트에 className의 class를 삭제한다.
기본 설정은 addClass API를 통해 추가 된 class만 적용되며 컴포넌트의 class 속성에 직접 정의 된 class를 삭제해야하는 경우는 config.xml파일의 설정을 아래와 같이 적용해야한다.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
classNameStringY삭제 할 class명
Sample
//아래와 같이 input 컴포넌트에 class를 정의 한 경우 <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> //config.xml 파일에 아래와 같이 정의. <style> <removeDefaultClass value="true" /> </style> //tmpInputClass class 삭제 input1.removeClass("tmpInputClass");
setDisabled( disabled )
컴포넌트의 disabled 속성을 설정한다. disabled 속성을 활성화 시키려면 true 비활성화 시키려면 false를 입력한다.
Parameter
nametyperequireddescription
disabledBooleanYdisabled 속성을 활성화 시키려면 true 비활성화 시키려면 false
Sample
//컴포넌트의 disabled 적용 componentId.setDisabled(true);
setEventPause( evList , flag )
컴포넌트의 이벤트를 disable 또는 enable시킨다.
Parameter
nametyperequireddescription
evListStringN대상 이벤트 목록. 해당 인자가 주어지지 않을 경우 해당 컴포넌트의 모든 사용자 이벤트가 대상이 된다. (null을 지정하면 된다.)
flagBooleanYtrue인 경우 pause시키며, false인 경우 pause를 해제한다.
Sample
input1.setEventPause("onclick", true); //onclick이벤트를 동적으로 pause 한다. input1.setEventPause("onfocus,onblur", false); //onfocus이벤트와 onblur이벤트의 pause를 해제한다. input1.setEventPause(null, true); //input에 등록된 모든 사용자 이벤트를 pause 한다.
setOpacity( value )
컴포넌트의 CSS Opacity(불투명도)값를 설정한다.
Parameter
nametyperequireddescription
valueNumberYOpacity 값 (0과 1사이의 실수)
Sample
componentId.setOpacity(0.45);
setPosition( left , top , mode )
컴포넌트의 위치(left,top)를 설정한다.
Parameter
nametyperequireddescription
leftNumberYleft의 값 또는 null.
topNumberYtop의 값 또는 null.
modeStringN[defulat:absolute, delta]absolute이면 x,y로 현재 값을 설정하고 delta이면 현재 값에 x,y값만큼을 더해서 설정.
Sample
//컴포넌트의 top만 100px로 설정. componentId.setPosition(null, 100);
setReadOnly( readOnly )
readOnly 속성값을 설정한다. readOnly 속성을 활성화 시키려면 true 비활성화 시키려면 false를 입력합니다.
Parameter
nametyperequireddescription
readOnlyBooleanYreadOnly 속성을 활성화 시키려면 true 비활성화 시키려면 false
Sample
//컴포넌트의 readonly 적용. componentId.setReadOnly(true);
setSize( width , heigth )
컴포넌트의 크기(width,height)를 설정한다.
Parameter
nametyperequireddescription
widthNumberY새로 설정할 컴포넌트의 width값 또는 null
heigthNumberY새로 설정할 컴포넌트의 height값 또는 null
Sample
//컴포넌트의 height만 100px로 설정. componentId.setSize(null,100);
setStyle( propertyName , value )
컴포넌트의 propertyName에 해당하는 style의 값을 설정합니다.
Parameter
nametyperequireddescription
propertyNameStringY바꾸고 싶은 style 값의 이름
valueStringY설정할 style의 값
Sample
예: 컴포넌트 스타일 width를 변경하고자 하는 경우. componentId.setStyle("width", 100); 픽셀 단위를 기본으로 하며, componentId.setStyle("width", "100px"); 과 동일하다. %단위의 표현을 하고자 하면 componentId.setStyle("width", "100%"); 로 명시하여 준다.
setUserData( key , value )
컴포넌트에 사용자 데이터를 설정한다. 컴포넌트에 설정이 가능한 key가 아닌 경우, key 설정이 불가능하며 log에 관련 내용이 출력 된다.
Parameter
nametyperequireddescription
keyStringY임의 데이터의 키
valueStringY임의 데이터의 값
Sample
//컴포넌트에 'data'라는 key로 'WebSquare'라는 값을 설정 할 경우 componentId.setUserData("data", "WebSquare"); //아래와 같이 컴포넌트에 설정이 가능한 key가 아닌 경우, key 설정이 불가능하다. componentId.setUserData("title", "WebSquare"); //log 표현 예시 ) !!!WARNING - [title] can't define as UserData
show( displayType )
컴포넌트를 화면에 보이도록 설정한다.
엔진 내부적으로는 CSS를 display속성과 visibility:show;으로 처리한다.
Parameter
nametyperequireddescription
displayTypeStringN[default:block ,inline ,none ,""]display의 속성 값.
Sample
//display 속성이 "block"이 된다. componentId.show(); //class에 적용된 display 속성 값을 다시 복구. componentId.show("");
toggleClass( className )
컴포넌트가 className의 이름을 가진 class를 가지고 있다면 제거하고, 가지고 있지 않다면 추가한다.
기본 설정은 addClass API를 통해 추가 된 class만 삭제되며 컴포넌트의 class 속성에 직접 정의 된 class를 삭제해야하는 경우는 config.xml파일의 설정을 아래와 같이 적용해야한다.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
classNameStringY설정 할 className
Sample
//아래와 같이 input 컴포넌트에 class를 정의 한 경우 <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> //config.xml 파일에 아래와 같이 정의. <style> <removeDefaultClass value="true" /> </style> //적용 된 tmpInputClass class 삭제 input1.toggleClass("tmpInputClass"); //tmpInputClass class를 다시 추가 input1.toggleClass("tmpInputClass");
trigger( type , array )
컴포넌트에 등록 된 특정 이벤트를 발생시킨다.
Parameter
nametyperequireddescription
typeStringY발생시킬 이벤트 이름
arrayArrayN이벤트 핸들러에 전달할 파라미터 배열
Sample
//input1 컴포넌트에 onclick이벤트를 발생시킨다. input1.trigger("onclick"); //input1에 onviewchange이벤트를 발생시키고 핸들러 함수에 (1,2) 인자를 전달하여 호출한다. input1.trigger("onviewchange", [1,2]);
unbind( type , function )
컴포넌트에 등록 된 이벤트를 제거한다.
Parameter
nametyperequireddescription
typeStringN제거할 이벤트 이름. 생략할 경우 해당 컴포넌트의 모든 이벤트를 제거한다.
functionFunctionN제거할 이벤트의 핸들러 함수. 생략할 경우 해당 이벤트 type으로 등록된 모든 핸들러 함수를 제거한다.
Sample
//input1에 등록된 모든 이벤트를 제거 input1.unbind(); //input1에 등록된 onviewchange이벤트 핸들러 함수를 모두 제거 input1.unbind("onviewchange"); //input1에 등록된 onviewchange이벤트에서 func1 이벤트 핸들러를 제거 input1.unbind("onviewchange", func1);
visible( flag )
[deprecated]show/hide 로 사용하거나 setStyle을 통해 visible 속성을 설정한다.
컴포넌트의 style 중 visibility 값을 설정한다. true이면 "visible", false이면 "hidden"을 설정.
Parameter
nametyperequireddescription
flagBooleanYvisibility 값을 설정할 값(true이면 "visible", false이면 "hidden"을 설정)