Columns 넓이
SBGrid는 Column 의 넓이를 설정 기능을 제공합니다.
요약
SBGrid는 열의 넓이를 설정 기능을 제공합니다.입력값
Number : 행의 index
Number : 설정 넓이값
Boolean : 초기화 수정여부
예) datagrid1.setColWidth( 1 , 100 , true)
상세설명
setColWidth()으로 지정한 행의 넓이 값을 설정합니다.각각 입력 값으로 첫번째는 너비를 지정할 행의 인덱스 번호, 두번째는 설정할 너비의 값, 세번째는 초기화 수행 여부이며 타입에 맞게 설정해 줍니다.
<!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_JSON_POI_100.js"></script>
<script type="text/javascript">
SBGrid.DEF.DOMAIN = "../../";
<script>
<script type="text/javascript">
var datagrid1;
function __createElements (strColWidth){
var objJson = {
"strParentId" : "sbGridArea",
"strId": "datagrid1",
"strCaption": "Longitude^Latitude^Name^City Code^classification",
"strColWidth": strColWidth,
"strJsonRef": "grid_data",
"strStyle": "width:700px; height:400px; ",
"strBackColorAlternate" : "#EFE0ED"
};
datagrid1 = createSBDataGrid(objJson);
var objCol = [
{ "id": "col1", "type": "output", "ref": "x", "style" : "text-align:center" },
{ "id": "col2", "type": "output", "ref": "y", "style" : "text-align:center" },
{ "id": "col3", "type": "output", "ref": "name" },
{ "id": "col4", "type": "combo", "ref": "city", "disabled" : "true", "strJsonNodeSet": "combo_city", "strLabelRef": "label", "strValueRef": "value" },
{ "id": "col5", "type": "combo", "ref": "code", "disabled" : "true", "strJsonNodeSet": "combo_code", "strLabelRef": "label", "strValueRef": "value", "style" : "text-align:center" }
];
datagrid1.createColumns(objCol);
};
function datagridsetColWidth(){
datagrid1.setColWidth(1,100 , true);
datagrid1.rebuild();
};
function changeColPercentWidth() {
var strColWidth = "20%, 20%, 20%, 20%, 20%";
__createElements(strColWidth);
};
</script>
</head>
<body onLoad="__createElements('160, 350, 100, 120, 160')" class="sbgrid_body">
<div id="button_group">
<input type="button" class="sbgrid_demo_button" style="width:700px;height:30px;" NAME="setColWidth" onclick="datagridsetColWidth();" value="'두번째' column의 width를 '100px'로 설정" />
<input type="button" class="sbgrid_demo_button" style="width:700px;height:30px;" NAME="setColWidth" onclick="changeColPercentWidth();" value="column의 width를 '%'로 설정" />
</div>
<div class="content_group">
<div id="sbGridArea"></div>
</div>
</body>
</html>