이벤트 제한
셀과 행을 수정 불가 상태로 변경합니다.
요약
셀과 행을 수정 불가 상태로 변경합니다.입력값
Number : 수정불가 Row Index
Number : 수정불가 Column Index
Boolean : true : 수정불가 / false : 수정불가 해제
예) 단일 셀에 대한 사항 : datagrid1.setCellDisabled(8,2,true);
단일 행에 대한 사항 : setRowDisabled(5, true);
상세설명
셀과 행을 'Disable'하게 되면 ReadOnly와 같은 상태가 되고 UI와 관련된 Event는 받지 못하게 됩니다.
<!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_116_people.js"></script>
<script type="text/javascript">
SBGrid.DEF.DOMAIN = "../../";
<script>
<script type="text/javascript">
var datagrid1;
$(document).ready(function(){
__createElements();
});
function __createElements (){
var GridInitInfo = {
"strParentId" : "sbGridArea",
"strId": "datagrid1",
"strCaption": "FirstName^LastName^Company^Address^City^County^State",
"strColWidth": "100, 100, 200, 200, 150, 130, 70, 100, 110, 110, 250, 300",
"strJsonRef": "grid_data",
"strDataHeight":"29",
"strStyle": "width:100%; height:480px; ",
"strBackColorAlternate" : "#f7f7f7",
"strSelectMode" : "free",
"strExplorerbar": "sortshow"
};
var SBGridColumnInitInfo = [
{ "id": "col1", "type": "input", "ref": "FirstName" },
{ "id": "col2", "type": "input", "ref": "LastName" },
{ "id": "col3", "type": "input", "ref": "Company" },
{ "id": "col4", "type": "input", "ref": "Address" },
{ "id": "col5", "type": "input", "ref": "City" },
{ "id": "col6", "type": "input", "ref": "County" },
{ "id": "col7", "type": "input", "ref": "State", "style" : "text-align:center" }
];
if(SBGrid.getGrid('datagrid1') != null){
datagrid1.destroy();
datagrid1 = null;
}
datagrid1 = createSBGrid(GridInitInfo,SBGridColumnInitInfo);
}
function createSBGrid(SBGridInitInfo, SBGridColumnInitInfo){
var objJSONdata = new Object();
objJSONdata.objSBGridInitInfo = SBGridInitInfo;
objJSONdata.arSBGridColumnInitInfo = SBGridColumnInitInfo;
return SBGrid.DEF.createSBGrid(objJSONdata);
};
function getdisable(){
var bVal =datagrid1.getCellDisabled( nClickedRow, nClickedCol);
if(bVal==1){
$('#test').val("반환값 :" + bVal + ", disable이 설정되어 있습니다.");
}
else{
$('#test').val("반환값 :" + bVal + ", disable이 설정되어 있지않습니다.");
}
}
function setdisable(){
datagrid1.setCellDisabled(8, 2,true);
datagrid1.setCellStyle('background-color', 8,2,8,2,'#D1B2FF');
};
function setdisables(){
datagrid1.setRowDisabled(5,true);
datagrid1.setCellStyle('background-color', 5,0,5,7,'#D1B2FF');
};
</script>
</head>
<body>
<div id="button_group">
<input type="button" class="sbgrid_demo_button2" style="width:33%; height:30px; background-color:#F2CB61;" id="button1" value="(8, 2) 수정 불가" onclick="setdisable();"/>
<input type="button" class="sbgrid_demo_button2" style="width:33%; height:30px; background-color:#FFC19E;" id="button2" value="5행 수정 불가" onclick="setdisables();"/>
<input type="button" class="sbgrid_demo_button3" style="width:33%; height:30px;" id="button2" value="반환 값 가져오기" onclick="getdisable();"/><br/><br/>
<input type="text" name="test" id="test" style="width:100%;" value=""/>
</div>
<div id="sbGridArea"></div>
</body>
</html>