Searching
SBGrid는 Data 검색은 메소드와 검색창에 대한 기능을 제공합니다.
검색창에 대한 기능은 그리드가 focusing 된 상태에서 Ctrl+F 를 눌러 활성화 할 수 있습니다.
요약
Data의 행의 위치를 찾습니다.입력값
String value : 검색을 위한 값
Number Row : 검색을 시작할 Row 위치
Number Col : 검색을 시작할 Col 위치
Boolean CaseSense : 대소 문자를 구문할지 여부[Default : false]
Boolean FullMatch : 전체 일치 여부 [Default : false]
예) datagrid1.findRow("45", 0, 3, false, true);
상세설명
검색어로 Row 와 Columns 의 위치로 Matching 되는 결과를 찾습니다.
<!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_10.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": "100, 100, 280, 120, 98",
"strJsonRef": "grid_data",
"strStyle": "width:700px; height:225px; ",
"strBackColorAlternate" : "#EFE0ED",
"bDataSearching" : true
};
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);
}
function dataSearch1(strValue, nRow, nCol)
{
var arSearchResult = new Array();
var nIndex = 0;
do
{
nIndex = datagrid1.findRow("45", nIndex+1, 3, false, true);
if (nIndex != -1)
{
arSearchResult.push(nIndex);
}
}
while (nIndex != -1);
var strLog = "city code가 'Washington D.C.'인 행은 ";
for (var i = 0 ; i < arSearchResult.length ; i++)
{
strLog += arSearchResult[i];
if( i != arSearchResult.length - 1)
{
strLog += ", ";
}
}
strLog += "입니다.";
alert(strLog);
}
function dataSearch2()
{
var arSearchResult = new Array();
var nIndex = 0;
do
{
nIndex = datagrid1.findRow("3", nIndex+1, 4, false, true);
if (nIndex != -1)
{
arSearchResult.push(nIndex);
}
}
while (nIndex != -1);
var strLog = "classification이 'Park'인 행은 ";
for (var i = 0 ; i < arSearchResult.length ; i++)
{
strLog += arSearchResult[i];
if( i != arSearchResult.length - 1)
{
strLog += ", ";
}
}
strLog += "입니다.";
alert(strLog);
}
</script>
</head>
<body onload="__createElements()" class="sbgrid_body">
<div id="button_group">
<input type="button" class="sbgrid_demo_button" style="width:348px;height:30px;" id="button_Data_Search1" value="city code가 'Washington D.C.'인 행 찾기" onclick="dataSearch1();"></input>
<input type="button" class="sbgrid_demo_button" style="width:348px;height:30px;" id="button_Data_Search2" value="classification이 'Park'인 행 찾기" onclick="dataSearch2();"></input>
</div>
<div class="content_group">
<div id="sbGridArea"></div>
</div>
</body>
</html>