IT/Nexacro 17

[Nexacro 17] 파라미터를 넘기면서 부모창의 중앙에 팝업 띄우기

Dev. Sean 2022. 7. 15. 15:45
반응형

화면에서 버튼을 클릭 시, 화면의 data를 가지고 팝업창을 띄워야하는 경우가 많이 생긴다.

 

공통 라이브러리에 cmn_openPopUpWindow 라는 이름으로 함수 생성

nexacro.Form.prototype.cmn_openPopUpWindow = function(strid, url, width, height, type, arg, funcCallback)

{	

	var arrFramelist = this.getOwnerFrame().all;

	for(var i=0; i<arrFramelist.length; i++) {
		if(arrFramelist[i].name == strid) {
			return false;
		}
	}

	if(type == "modeless") {
    
		nexacro.open(strid, url, this.getOwnerFrame(), arg, "showtitlebar=false layered=true openlign='center middle'", 0, 0);	

	} else {

		var objChildFrame = new ChildFrame();
        
		objChildFrame.init(strid, 0, 0, width, height, null, null, url);
        
		if(type == "modal_white") objChildFrame.set_overlaycolor("#ffffff00");

		objChildFrame.set_openalign("center middle");
		objChildFrame.set_showtitlebar(false);

		if(type != "notice")

		{

			objChildFrame.set_background("white");
			objChildFrame.set_borderRadius("round 7px 7px");

		}

		objChildFrame.showModal(strid, this.getOwnerFrame(), arg, this, funcCallback);

	}

};

 

 

 

이제 팝업화면을 띄우려는 창에서 버튼에 btn_onclick 이벤트를 걸어준다.

this.btn_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	if(obj.name == "btn_select") this.fn_select_confirm();
}

버튼 클릭시 btn_onclick 이벤트가 발생하고 fn_select_confirm 실행

this.fn_select_confirm = function()
{
	var param = new Array();
	if(this.ds_customerInfo_list.findRow("ROW_CHK","1")>=0)
    {
    	param["custTel"] = "1234";
    	this.cmn_openPopUpWindow("POPUP0005","POPUP0005.xfdl",500,335,"modal",param,'callbackFunc_pop');
    }
    else
    	this.alert("선택한 항목이 없습니다");
}


this.callbackFunc_pop = function(strID, variant)
{
	switch(strID) {
    	case "POPUP0005" :
        	break;
    }
}

이렇게 하면 param 에 고객전화번호 정보를 담아서 

팝업창에 던져준다. 

 

팝업창에서는 

this.parent.custTel로 trace를 찍어보면 넘겨받은 값이 출력된다.

 

팝업창에서 부모창으로 다시 데이터를 다시 넘겨주는 건 다음 글에...

반응형