정렬 EVENT 동작을 확인합니다.


요약

정렬 EVENT 동작을 확인합니다.

입력값

String : 이벤트


String : 이벤트 발생시 호출할 사용자 함수명



예) datagrid1.addEventListener("onbeforesort","eventProcess","","")
function eventProcess(event){
//cell값 변경시 동작되는 부분//
}

상세설명

정렬 EVENT는 정렬이 수행되기 전에 동작하는 onbeforesort, 정렬이 수행된 이우에 onaftersort 로 구분됩니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page language="java"   contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko">
<head>
	<meta content="IE=9" http-equiv="X-UA-Compatible">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>SoftBowl SBGrid Example</title>
	<link href="../../css/common.css" type="text/css" rel="stylesheet"/>
    <link href="../../css/common/stylesheet.css" type="text/css" rel="stylesheet"/>
	<link href="../../kr/co/softbowl/css/Sbgrid_default.css" type="text/css" rel="stylesheet"  />
	<link href="../../css/user_defined_sbgrid_style.css" type="text/css" rel="stylesheet"/>
	<script type="text/javascript" src="../../js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="../../kr/co/softbowl/SBGrid.js"></script>
	<script type="text/javascript" src="../../js/DATA_JSON_116_people.js"></script>
	<script type="text/javascript">
		SBGrid.DEF.DOMAIN = "../../";
		var datagrid1;
	
		$(document).ready(function(){
			__createElements();
		});
		
				
		function __createElements (){
			var GridInitInfo = 	{
								"strParentId" : "sbGridArea",
								"strId": "datagrid1",
								"strCaption": "FirstName^LastName^Company^Address^City^County^State^ZIP_Code^Phone^Fax^E-mail^HomePage Address",
								"strColWidth": "100, 100, 250, 250, 180, 150, 70, 100, 110, 110, 250, 300",
								"strJsonRef": "grid_data",
								"strStyle": "width:100%; height:280px; ",
								"strDataHeight":"29",
								"strBackColorAlternate" : "#f7f7f7",
								"strExtendLastCol" : "scroll",
								"strExplorerbar": "sortshow"
						};
			var SBGridColumnInitInfo = 	[
								{ "id": "col1", "type": "output", "ref": "FirstName", "style": "text-align:left;padding-left:5px" },
								{ "id": "col2", "type": "output", "ref": "LastName", "style": "text-align:left;padding-left:5px" },
								{ "id": "col3", "type": "output", "ref": "Company", "style": "text-align:left;padding-left:5px" },
								{ "id": "col4", "type": "output", "ref": "Address", "style": "text-align:left;padding-left:5px" },
								{ "id": "col5", "type": "output", "ref": "City", "style": "text-align:center;" },
								{ "id": "col6", "type": "output", "ref": "County", "style": "text-align:center;" },
								{ "id": "col7", "type": "output", "ref": "State", "style": "text-align:center;" },
								{ "id": "col8", "type": "output", "ref": "ZIP", "style": "text-align:center;" },
								{ "id": "col9", "type": "output", "ref": "Phone", "style": "text-align:center;" },
								{ "id": "col10", "type": "output", "ref": "Fax", "style": "text-align:center;" },
								{ "id": "col11", "type": "output", "ref": "Email", "style": "text-align:left;padding-left:5px" },
								{ "id": "col12", "type": "output", "ref": "Web", "style": "text-align:left;padding-left:5px" }
							];
			if(SBGrid.getGrid('datagrid1') != null){
				datagrid1.destroy();
				datagrid1 = null;				
			}
			
			datagrid1 = createSBGrid(GridInitInfo,SBGridColumnInitInfo);
			
			
			datagrid1.addEventListener("onbeforesort","eventProcess","","");
			datagrid1.addEventListener("onaftersort","eventProcess","","");  
			
		};

		function createSBGrid(SBGridInitInfo, SBGridColumnInitInfo){
			var objJSONdata = new Object();
			objJSONdata.objSBGridInitInfo = SBGridInitInfo;
			objJSONdata.arSBGridColumnInitInfo = SBGridColumnInitInfo;
			return SBGrid.DEF.createSBGrid(objJSONdata);
		};
		
		function softbowl_ready_model (event){
			model1_ready();
		};
		
		function eventProcess( event){
			var strMessage = "Row = " +datagrid1.getMouseRow() + " Col = " + datagrid1.getMouseCol();
			var strEvent = "event 발생 위치 : " + strMessage + " event 명 :" +event.name; 
			eventName.value = strEvent +  "\n"  +eventName.value;
		};
		
	</script>
</head> 
<body onload="__createElements()" class="sbgrid_body">
	
    <div id="sbGridArea"></div>
    </br>
    <textarea  id="eventName"  style="width:348px; height:90px; overflow:hidden"></textarea>                
  
</body>
</html>