SBGrid는 XML을 이용하여 DATA를 표시할 수 있습니다.


요약

SBGrid는 XML을 이용하여 DATA를 표시할 수 있습니다.

입력값

String : Xpath Data name



예) SBGrid.DS.XMLStorage.getUniqueStorage().getInstance().loadXML(instance_data)

상세설명

StrNodeSet 속성으로 데이터 path 설정을 하고 loadXML()으로 DATA를 표시할 수 있습니다.
	
<!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>
	<script type="text/javascript" src="../../kr/co/softbowl/js/Library/json-minified.js"></script>
	<script type="text/javascript" src="../../js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="../../kr/co/softbowl/js/Library/json2.js"></script>
		
	<script type="text/javascript" src="../../kr/co/softbowl/SBGrid.js"></script>
	
	<script type="text/javascript" src="../../js/DATA_XML_POI_100.js"></script>
		
	<script type="text/javascript">			
		SBGrid.DEF.DOMAIN = "../../";
	<script>
	
	<script type="text/javascript">
		var datagrid1, 
		    datagrid2;
		    
    
	    
	    $(document).ready(function(){
	        __createElements();
	    });
		function __createElements (){
			var GridInitInfo = 	{
								"strParentId" : "sbGridArea",
								"strId": "datagrid1",
								"strCaption": "Longitude^Latitude^Name^City Code^Classification",
								"strColWidth": "100, 100, 250, 139, 92",
								"strNodeSet": "/root/grid/data",
								"strStyle": "width:100%; height:480px; ",
								"strDataHeight":"29",
								"strBackColorAlternate" : "#f7f7f7",
								"strExtendLastCol" : "scroll"
						};
			 var SBGridColumnInitInfo = 	[
								{ "id": "col1", "type": "output", "ref": "x" },
								{ "id": "col2", "type": "output", "ref": "y" },
								{ "id": "col3", "type": "output", "ref": "name" },
								{ "id": "col4", "type": "output", "ref": "city", "strNodeSet": "/root/combo_city/nodeset", "strLabelRef": "label", "strValueRef": "value" },
								{ "id": "col5", "type": "output", "ref": "code", "strNodeSet": "/root/combo_code/nodeset", "strLabelRef": "label", "strValueRef": "value" }
							];
			datagrid1 = createSBGrid(GridInitInfo,SBGridColumnInitInfo);
			
			datagrid1.setRowHeight(0, 30);
			
		}		
		function createSBGrid(SBGridInitInfo, SBGridColumnInitInfo){
			var objJSONdata = new Object();
			objJSONdata.objSBGridInitInfo = SBGridInitInfo;
			objJSONdata.arSBGridColumnInitInfo = SBGridColumnInitInfo;
			return SBGrid.DEF.createSBGrid(objJSONdata);
		}
		 
		function loadXmlData(){
		    SBGrid.DS.XMLStorage.getUniqueStorage().getInstance().loadXML(instance_data);
		    datagrid1.refresh();
		}
		
		function loadXmlData2(){
		    SBGrid.DS.XMLStorage.getUniqueStorage().getInstance().loadXML(instance_data);
		    datagrid2.refresh();
		}
		
		function getValueOfXpath(){
			var strValue = "/root/grid/data[2]/name = "
			strValue += SBGrid.DS.XMLStorage.getUniqueStorage().getValue(("/root/grid/data[2]/name"));
			alert(strValue);
		}
		
		function setValueOfXpath(){
			SBGrid.DS.XMLStorage.getUniqueStorage().setValue(("/root/grid/data[2]/name"),"Data가 변경되었습니다.");
			datagrid1.refresh();
		}
		
		function setValueOfXpath2(){
			SBGrid.DS.XMLStorage.getUniqueStorage().setValue(("/root/grid/data[2]/name"),"Data가 변경되었습니다.");
			datagrid2.refresh();
		}
	</script>
</head> 
<body onload="__createElements()" class="sbgrid_body">
	<div id="button_group">
            <input type="button" class="sbgrid_demo_button" style="width:700px;height:30px;" id="button_XML_Load" value="Load XML Data" onclick="loadXmlData();"></input>
            <input type="button" class="sbgrid_demo_button" style="width:348px;height:30px;" id="button_getValue" value="Xpath로  XML DATA 가져오기" onclick="getValueOfXpath();"></input>
            <input type="button" class="sbgrid_demo_button" style="width:348px;height:30px;" id="button_setValue" value="Xpath로  XML DATA 설정하기" onclick="setValueOfXpath();"></input>
        </div>
        <div class="content_group">
            <div id="sbGridArea"></div>
        </div>
    </div>		
</body>
</html>