Mouse Event
Mouse 선택에 따른 EVENT 동작을 확인 합니다.
요약
Mouse 관련 EVENT 동작을 확인 합니다.입력값
String : 이벤트
String : 이벤트 발생시 호출할 사용자 함수명
예) datagrid1.addEventListener("onclick","eventProcess","","");
function eventProcess(event){
//cell값 변경시 동작되는 부분//
}
상세설명
SBGrid 내에서 마우스 좌측 버튼 클릭 시에 onclick, 더블클릭 시에 ondbclick 이벤트가 발생합니다.
<!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>
<link href="../../css/common.css" type="text/css" rel="stylesheet"/>
<link href="../../css/common/stylesheet.css" type="text/css" rel="stylesheet"/>
<link href="../../kr/co/softbowl/css/Sbgrid_default.css" type="text/css" rel="stylesheet" />
<link href="../../css/user_defined_sbgrid_style.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="../../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../../kr/co/softbowl/SBGrid.js"></script>
<script type="text/javascript" src="../../js/DATA_JSON_POI_10.js"></script>
<script type="text/javascript">
SBGrid.DEF.DOMAIN = "../../";
var datagrid1;
function __createElements (){
var objJson = {
"strParentId" : "sbGridArea",
"strId": "datagrid1",
"strCaption": "Longitude^Latitude^Name^City Code^classification",
"strColWidth": "100, 100, 280, 120, 96",
"strJsonRef": "grid_data",
"strStyle": "width:700px; height:225px; ",
"strBackColorAlternate" : "#EFE0ED",
"strExplorerbar": "sortshowmove"
};
datagrid1 = createSBDataGrid(objJson);
var objCol = [
{ "id": "col1", "type": "input", "ref": "x", "style" : "text-align:center" },
{ "id": "col2", "type": "input", "ref": "y", "style" : "text-align:center" },
{ "id": "col3", "type": "input", "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.refresh();
datagrid1.addEventListener("onclick","eventProcess","","");
datagrid1.addEventListener("ondblclick","eventProcess","","");
}
</script>
<script type="text/javascript">
function softbowl_ready_model (event)
{
model1_ready();
}
function eventProcess( event)
{
var strMessage = "Row = " +datagrid1.getMouseRow() + " Col = " + datagrid1.getMouseCol();
var strEvent = "event 발생 위치 : " + strMessage + " event 명 :" +event.name;
eventName.value = strEvent + "\n" +eventName.value;
}
</script>
</head>
<body onload="__createElements()" class="sbgrid_body">
<div id="sbGridArea"></div>
</br>
<textarea id="eventName" style="width:348px; height:90px; overflow:hidden"></textarea>
</body>
</html>