SBGrid는 행 추가 기능을 제공합니다.


요약

SBGrid는 Row 추가 기능을 제공합니다.

상세설명

첫번째 Row 에 추가 : datagrid1.insertRow(1, 'above');

마지막 Row 에 추가 : datagrid1.addRow();

선택 Row 이전에 추가 : datagrid1.insertRow(datagrid1.getRow(), 'above');

선택 Row 이후에 추가 : datagrid1.insertRow(datagrid1.getRow(), 'below');

선택 Row 삭제 : datagrid1.deleteRow(datagrid1.getRow());

<!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_5_people.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": "output^input^combo^checkbox^radio",
								"strColWidth": "100,100,100,100,100,100",
								"strJsonRef": "grid_data",
								"strStyle": "width:700px; height:200px; ",
								"strBackColorAlternate" : "#EFE0ED",
								"strExtendLastCol" : "scroll"
					};
										
			datagrid1 = createSBDataGrid(objJson);
			var objCol =	[
								{ "id": "col1", "type": "output", "style" : "text-align:center", "ref": "output" },
								{ "id": "col2", "type": "input", "style" : "text-align:center", "ref": "input" },
								{ "id": "col5", "type": "combo", "ref": "combo", "strJsonNodeSet": "combo_city", "strLabelRef": "label", "strValueRef": "value" },
								{ "id": "col6", "type": "checkbox", "ref": "checkbox" },
								{ "id": "col7", "type": "radio", "ref": "radio" }
					];
			datagrid1.createColumns(objCol);
		};
        
        function addFirstRows() {
            datagrid1.insertRow(1, 'above');
            datagrid1.refresh();
        };
        
        function addLastRows() {
            datagrid1.addRow();
            datagrid1.refresh();
        };
      
        function addBeforeRows() {
            datagrid1.insertRow(datagrid1.getRow(), 'above');
            datagrid1.refresh();
        };
        function addAfterRows() {
            
            datagrid1.insertRow(datagrid1.getRow(), 'below');
            datagrid1.refresh();
        };
        function delRows() {
            datagrid1.deleteRow(datagrid1.getRow());
            datagrid1.refresh();
        };
	</script>
</head> 
<body onload="__createElements()" class="sbgrid_body" >
	
        <div id="button_group">
            <input type="button" class="sbgrid_demo_button" style="width:700px;height:30px;"  onclick="addFirstRows();" value="첫번째 Row 에 추가" />
            <input type="button" class="sbgrid_demo_button" style="width:700px;height:30px;"  onclick="addLastRows();" value="마지막 Row 에 추가" />
            <input type="button" class="sbgrid_demo_button" style="width:700px;height:30px;"  onclick="addBeforeRows();" value="선택 Row 이전에 추가" />
            <input type="button" class="sbgrid_demo_button" style="width:700px;height:30px;"  onclick="addAfterRows();" value="선택 Row 이후에 추가" />
            <input type="button" class="sbgrid_demo_button" style="width:700px;height:30px;"  onclick="delRows();" value="선택 Row 삭제" />
        </div>
        <div class="content_group">
            <div id="sbGridArea"></div>
        </div>
   
</body>
</html>