Columns 추가
SBGrid는 열 추가 기능을 제공합니다.
요약
SBGrid는 열추가 기능을 제공합니다.입력값
String : Column 의 속성
예) datagrid1.addColumn("ref:rest;type:input");
상세설명
addColumn 의 첫번째값으로 colAttribute(열의 속성 지정)<!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; 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); }; var i = 0; function addColumns() { if (i >= 0 ) { i++; datagrid1.addColumn("id:col7; ref:State; type:output;"); datagrid1.setCaption(datagrid1.getCaption() + "State" + i); datagrid1.refresh(); } }; function removeColumns() { if (i > 0) { i--; datagrid1.removeColumn(); alert('추가된 컬럼을 삭제합니다.'); } else { alert('추가된 컬럼이 없어 삭제를 Skip 합니다.'); } }; </script> </head> <body onload="__createElements()" class="sbgrid_body" > <div id="button_group"> <input type="button" class="sbgrid_demo_button" style="width:700px;height:30px;" NAME="setColWidth" onclick="addColumns();" value="Column 추가" /> <input type="button" class="sbgrid_demo_button" style="width:700px;height:30px;" NAME="setColWidth" onclick="removeColumns();" value="Column 삭제" /> </div> <div class="content_group"> <div id="sbGridArea"></div> </div> </body> </html>