var datagrid;
var SBGridProperties = {};
function createGrid(){
SBGridProperties.parentid = 'SBGridArea';
SBGridProperties.id = 'datagrid';
SBGridProperties.jsonref = 'ct_data.resources';
SBGridProperties.rowheader = ['seq', 'update'];
SBGridProperties.selectmode ='byrow';
SBGridProperties.columns = [
{caption : [''], ref : 'check', width : '30px', style : 'text-align:center', type : 'checkbox'},
{caption : ['학원명'], ref : 'academy', width : '168px', style : 'text-align:left', type : 'input'},
{caption : ['설립자(성명)'], ref : 'name', width : '163px', style : 'text-align:left', type : 'output'},
{caption : ['전화번호'], ref : 'phone', width : '120px', style : 'text-align:center', type : 'input'},
{caption : ['학원주소'], ref : 'addr', width : '407px', style : 'text-align:left', type : 'textarea'},
{caption : ['교습과정'], ref : 'curriculum', width : '100px', style : 'text-align:center', type : 'combo', typeinfo : {ref : 'newComboData', displayui : true, label : 'label', value : 'value'}},
{caption : ['교습과목(반)'], ref : 'class2', width : '100px', style : 'text-align:center', type : 'combo', typeinfo : {ref : 'classData', displayui : true, label : 'label', value : 'value', filtering : {usemode : true, uppercol : 5, attrname : 'code'}}},
{caption : ['교육시작일'], ref : 'startday', width : '100px', style : 'text-align:center', type : 'datepicker', typeinfo : {locale : 'ko' , dateformat :'yymmdd'}, format : {type:'date', rule:'yyyy-mm-dd', origin : 'yyyymmdd' }},
{caption : ['교육종료일'], ref : 'endday', width : '100px', style : 'text-align:center', type : 'inputdate', typeinfo : {locale : 'ko' , dateformat :'yymmdd'}, format : {type:'date', rule:'yyyy-mm-dd', origin : 'yyyymmdd' }},
{caption : ['바로가기'], ref : 'link', width : '100px', style : 'text-align:left', type : 'outputbutton'}
];
datagrid = _SBGrid.create(SBGridProperties);
datagrid.bind('click','gridClick');
};
function rowStatus_p(){
var nRow = datagrid.getRow();
if(datagrid.getRow() < 0){
alert('status를 추가할 행을 선택해주세요.');
}else{
if($('#tValue').val()=='insert'){
datagrid.addStatus(nRow,'insert');
}else if($('#tValue').val()=='update'){
datagrid.addStatus(nRow,'update');
}else if($('#tValue').val()=='delete'){
datagrid.addStatus(nRow,'delete');
}
}
gridClick();
};
function gridClick(){
var nRow = datagrid.getRow();
var status = datagrid.getRowStatus(nRow);
if(status==0){
status+=' (New)';
}else if(status==1){
status+=' (Insert)';
}else if(status==2){
status+=' (Update)';
}else if(status==3){
status+=' (Insert+Update)';
}else if(status==4){
status+=' (Delete)';
}else if(status==5){
status+=' (Insert+Delete)';
}else if(status==6){
status+=' (Update+Delete)';
}else if(status==7){
status+=' (Insert+Update+Delete)';
}else{
status='0 (New)';
}
$('#textValue').text(nRow+'행의 상태값 : '+status);
}