SBGrid 설정
SBGrid는 XML/JSON을 이용하여 쉽게 생성할 수 있습니다.
요약
SBGrid는 XML/JSON을 이용하여 쉽게 생성할 수 있습니다.입력값
String : 초기 설정값
String : 컬럼 정보값
예) createSBGrid(SBGridInitInfo, SBGridColumnInitInfo)
상세설명
SBGrid 지역변수 objJson에 Json Object 형태로 각각의 Attribute값을 설정하여 그리드 객체를 생성하는 함수 createSBDataGrid( )호출시 인자값으로 넣어준다.
<!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">
SBGrid.DEF.DOMAIN = "../../";
<script>
<script type="text/javascript">
// Unique 한 ID 변수 설정
var datagrid1;
function __createSBGrid (){
// 그리드 기본 틀 설정
var GridInitInfo = {
"strParentId" : "sbGridArea",
"strId": "datagrid1",
"strCaption": "Longitude^Latitude^Name^City Code^classification",
"strColWidth": "100, 100, 250, 120, 80",
"strJsonRef": "grid_data",
"strStyle": "width:450px; height:480px; ",
"strBackColorAlternate" : "#EFE0ED"
};
// 그리드 기본 틀 작성
datagrid1 = createSBDataGrid(obJson);
// 각 컬럼의 Cell Type 설정
var ColumnInitInfo = [
{"id": "col1","type": "output","ref": "x"},
{"id": "col2","type": "output","ref": "y"},
{"id": "col3","type": "output","ref": "name"}
{"id": "col4","type": "output","ref": "city",},
{"id": "col5","type": "output","ref": "code","style" : "text-align:center"}
];
// 그리드에 컬럼 타입 적용
datagrid1.createColumns(objCol);
}
</script>
</head>
<body >
<div id = "sbGridArea"></div>
</body>
</html>