Grouping 된 Grid 의 펼치고 접힐때의 EVENT 동작을 확인 합니다.


요약

Group화 된 셀에 대한 Expand/Collapse EVENT 동작을 수행합니다.

입력값

Number : 그룹 레벨


Boolean : 상태 (true : 그룹펼침 / false : 그룹닫힘)



예) datagrid1.setGroupCollapsed(1,bStatus);
function eventProcess(event){
//cell값 변경시 동작되는 부분//
}

상세설명

특정 행이 하위 그룹을 가지고 있다면 그 행을 펼치고 닫는 동작을 수행합니다. bStatus값의 true는 그룹 펼침, false는 그룹 닫음을 의미합니다.
 <!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_XML_JSON_Group.js"></script>
	<script type="text/javascript">
		SBGrid.DEF.DOMAIN = "../../";
		var datagrid1;
		function __createElements (){
			var objJson = 	{
								"strParentId" : "sbGridArea",
								"strId": "datagrid1",
								"strCaption": "Name^Korean^English^Math^Absence^Depth",
								"strColWidth": "150,150,150,150,150",
								"strJsonRef": "scoreJson.root.scoreSample.gridData.grid",
								"strStyle": "width:700px; height:370px; "
							};
										
			datagrid1 = createSBDataGrid(objJson);
			var objCol =	[
								{ "id": "col1", "type": "output", "ref": "name" },
								{ "id": "col2", "type": "output", "ref": "math" },
								{ "id": "col3", "type": "output", "ref": "history" },
								{ "id": "col4", "type": "output", "ref": "science" },
								{ "id": "col5", "type": "output", "ref": "absence" }
							];
			datagrid1.createColumns(objCol);
			makeGroupData(datagrid1);
			
			datagrid1.addEventListener("oncollapse","eventProcess","","");
			datagrid1.addEventListener("onexpanded","eventProcess","","");
		}
		
		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;
		}
	    
		
		function makeGroupData(grid)
		{
			for(var i=1; i<grid.rows; i++)
			{
				
				if( grid.valueMatrix(i,2) == "SCORE")
					grid.setGroupLevel(i, 1);
				else 
					grid.setGroupLevel(i, 2);
			}
			
			grid.setGroup("complete");
		}
		
		function setCollapsed(grid, bStatus)
		{			
			grid.setGroupCollapsed(1,bStatus);
			grid.setGroupCollapsed(6,bStatus);
			grid.setGroupCollapsed(12,bStatus);
		}
	</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>