선택된 Row 반환
선택된 행들의 INDEX들을 배열로 반환합니다.
요약
선택된 행들의 INDEX들을 배열로 반환합니다.입력값
Number : 특정 Row Index
예) 단일행의 반환 : datagrid1.selectRow(nRow);
복수행의 반환 : datagrid1.getSelectedRows();
상세설명
단일 행이나 다중 행을 선택 시 해당 행의 인덱스 값을 배열로 설정하고 반환합니다.
<!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 (){
var objJson = {
"strParentId" : "sbGridArea",
"strId": "datagrid1",
"strCaption": "Longitude^Latitude^Name^City Code^classification",
"strColWidth": "160, 350, 100, 120, 170",
"strJsonRef": "grid_data",
"strDataHeight":"29",
"strStyle": "width:100%; height:480px; ",
"strBackColorAlternate" : "#f7f7f7"
};
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", "strJsonNodeSet": "combo_city", "strLabelRef": "label", "strValueRef": "value" },
{ "id": "col5", "type": "combo", "ref": "code", "strJsonNodeSet": "combo_code", "strLabelRef": "label", "strValueRef": "value", "style" : "text-align:center" }
];
datagrid1.createColumns(objCol);
datagrid1.selectRow(2);
datagrid1.selectRow(5);
datagrid1.selectRow(7);
}
function getselectRow() {
alert("선택한 행은 " + datagrid1.getSelectedRows() + "행 입니다.");
};
</script>
</head>
<body onload="__createElements()" class="sbgrid_body">
<div id="button_group">
<input type="button" class="sbgrid_demo_button" name="2" style="width:700px;height:30px;" onclick="getselectRow();" value="선택된 행들의 Index를 배열로 반환"/>
</div>
<div class="content_group">
<div id="sbGridArea"></div>
</div>
</body>
</html>