반응형
1. 모달(Modal) 팝업 처리
1 - 1 flow
1) 부모 화면에서 모달 팝업 화면으로 파라미터 전송
2) 모달 팝업 화면에서는 전송된 파라미터 수신
3) 부모 화면에 리턴값을 전달하고 모달 팝업 화면 종료
1 - 2 오픈 스크립트
// ChildFrame 오브젝트 생성 후 초기화
var objChildFrame = new ChildFrame();
objChildFrame.init("chf_popup1"
, 0
, 0
, 400
, 350
, null
, null
, "Form::Form_Popup_Sub.xfdl");
// ChildFrame 드래그 이동 가능 영역 설정
objChildFrame.set_dragmovetype("all");
// 팝업 창 실행 위치(중앙)
objChildFrame.set_openalign("center middle");
// 부모 Frame에 적용할 색상
objChildFrame.set_overlaycolor("RGBA(196,196,196,0.5)")
// ChildFrame에 색상 적용(투명화)
// objChildFrame.set_showtitlebar(false);
// objChildFrame.set_background("transparent");
// objChildFrame.set_overlaycolor("RGBA(38,38,38,0.7)");
// 팝업창에 전송할 파라미터(변수명:변수값, 변수명:변수값 의 형식)
var objParam = {param1:this.edt_param1.value
, param2:this.edt_param2.value
, param3:this.ds_parent};
// ChildFrame을 모달 형식으로 표시하는 showModal메소드 실행
objChildFrame.showModal(this.getOwnerFrame()
, objParam
, this
// 종료시 실행할 callback메서드
, "fn_popupCallback");
-----------------------------------------------------------------------------
// Return값을 받을 callback메서드 지정, String형식으로만 가능
this.fn_popupCallback = function(strPopupID, strReturn) {
if(strReturn == undefined){
return;
}
if(strPopupID == "chf_popup1"){
this.alert("Return Value: " + strReturn);
}
}
};
-----------------------------------------------------------------------------
// String 이외의 값을 전송하기 위해 Object형식의 인자를 갖는 메서드 생성
this.fn_parent = function(pObj) {
this.ds_parent.copyData(pObj);
};
-----------------------------------------------------------------------------
// 팝업창에서 onload 이벤트에 지정할 parameter를 받는 스크립트
this.form_onload = function(obj:nexacro.Form,e:nexacro.LoadEventInfo){
// 부모 Frame에서 주는 parameter받음
var strParam1 = this.parent.param1;
var strParam2 = this.parent.param2;
var objParam = this.parent.param3;
// String형식의 파라미터는 팝업창의 Edit컴포넌트에 표현
this.Edit00.set_value(strParam1);
this.Edit01.set_value(strParam2);
// Dataset 형식의 파라미터를 팝업창의 ds_child 데이터 셋에 복사하여 팝업창의 그리드에 바인드 하여 표현
this.ds_child.copyData(objParam);
this.Grid00.set_binddataset("ds_child");
this.Grid00.createFormat();
};
-----------------------------------------------------------------------------
// 종료 스크립트
● close() 메소드를 실행합니다.
팝업창을 호출한 부모화면에 넘겨줄 값을 문자열로 설정 할 수 있습니다.
넘겨주는 값은 부모창의 콜백 함수에서 받습니다.
var strReturn = this.Edit00.value;
this.close(strReturn);
● 팝업창에서 부모 화면의 함수를 호출하여 리턴값을 넘겨줍니다.
String 이외의 형식, 또는 여러개의 값을 전송해야 하는 경우에 사용 할 수 있습니다.
"opener"를 이용하여 부모 객체를 접근 할 수 있습니다.
this.opener.fn_parent(this.ds_child);
this.close();
● 팝업창에서 부모 화면의 객체를 직접 제어 합니다.
"opener"를 이용하여 부모 객체를 접근 할 수 있습니다.
this.opener.ds_parent.clearData();
var nRow = this.opener.ds_parent.addRow();
this.opener.ds_parent.copyRow(nRow, this.ds_child, this.ds_child.rowposition);
this.close();
2. 모달리스(ModelLess) 팝업 처리
// 팝업창 사이즈 지정
var nW = 500;
var nH = 400;
// 중앙에 띄우기 위한 좌표 계산
var objApp = nexacro.getApplication();
var nLeft = (objApp.mainframe.width / 2) - Math.round(nW / 2);
var nTop = (objApp.mainframe.height / 2) - Math.round(nH / 2) ;
nLeft = system.clientToScreenX(this, nLeft);
nTop = system.clientToScreenY(this, nTop);
// 팝업창에 전송할 파라미터 설정
var objParam = {param1:this.edt_param1.value
, param2:this.edt_param2.value
, param3:this.ds_parent};
//팝업창에 적용할 속성 지정 ("속성1=속성값1 속성2=속성값2" 형식으로 지정), 스타일 관련 속성 지정 불가
var sOpenStyle = "dragmovetype=all"
+ " resizable=true"
+ " titletext=Modeless"
+ " showtitlebar=true"
+ " showstatusbar=false";
// Modeless 창으로 표시하는 open() 메서드 실행
nexacro.open("chf_popup3"
, "Form::Form_Popup_Sub.xfdl"
, this.getOwnerFrame()
, objParam
, sOpenStyle
, nLeft
, nTop
, nW
, nH
, this);
3. PopupDiv 컴포넌트 이용 팝업 처리
// PopupDiv 컴포넌트 위치 지정
var nX = parseInt(obj.width);
var nY = parseInt(obj.height);
// 메서드 실행
this.PopupDiv00.trackPopupByComponent(obj
, nX
, nY
, null
, null
// callback 함수
, "fn_pDivCallback");
-----------------------------------------------------------------------------
// PopupDiv 닫는 스크립트
this.PopupDiv00.closePopup("Return Value");
-----------------------------------------------------------------------------
// callback 함수 지정
this.fn_pDivCallback = function(objID, rtnValue) {
if(rtnValue == ""){
return;
}
if(objID == "PopupDiv00") {
this.alert("Return Value: " + rtnValue);
}
};
반응형
'Frontend > Nexacro' 카테고리의 다른 글
[넥사크로] 다시 해보기 (0) | 2023.07.07 |
---|---|
[넥사크로] 메인 화면 구성 (0) | 2023.07.07 |
[넥사크로] 화면 CRUD 처리 (0) | 2023.07.07 |
[넥사크로] 데이터 통신(서버 설정) (0) | 2023.07.07 |
[넥사크로] 그리드 셀 표현 (0) | 2023.07.07 |