<div id="sigmagrid" style="border: 0px solid #cccccc; background-color: #f3f3f3; padding: 5px;
height: 200px; width: 700px;">
</div>
var __GRID_DATA__=
[
["一郎","89","100","70",'75'],
["花子","91","95","85",'34']
];
var dsOption= {
fields :[
{name : 'student' },
{name : 'kokugo' },
{name : 'sansu' },
{name : 'rika' },
{name : 'shakai' },
],
recordType : 'array',
data : __GRID_DATA__
}
var colsOption = [
{id:'student' ,header:'生徒',width:100},
{id:'kokugo' ,header:'国語',width:50},
{id:'sansu' ,header:'算数',width:50},
{id:'rika' ,header:'理科',width:50},
{id:'shakai' ,header:'社会',width:50}
];
var gridOption={
id : grid_id ,
width:'700',
height:'200',
container : 'sigmagrid',
replaceContainer : true,
dataset : dsOption ,
columns : colsOption,
skin : 'default'
};
//「生徒」カラムをテキスト入力できるようにする
{id:'student' ,header:"生徒",width:100,frozen:true,
editor: {type:"text"}
},
//「備考」カラムをテキストエリアにする
{id:'biko',header:"備考",width:170,resizable:false,
editor: {type:"textarea",width:'170px',height:'100px'
}
//「誕生日」カラムを日付入力にする
{id:'birthday' ,header:"誕生日",width:100,resizable:false,
editor: {type:"date"}
},
//「得意科目」を選択形式にする
{id:'tokuikamoku',header:"得意科目",width:100,resizable:false,
editor: {type:"select",
options: {'国語':'国語','算数':'算数','理科':'理科','社会':'社会','体育':'体育'}}
},
{id:'student',header:"生徒",width:100,frozen:true,
editor: {type:"text"},validRule:['R']
},
//「身長」カラムに入力規則を設定
{id:'sincyo' ,header:"身長",width:50,align:"right",sortable:false,resizable:false,
editor: {type:"text",
validator : function(value,record,colObj,grid){
value=Number(value);
if ( !isNaN(value) && ( value>0 ) ) {
return true;
}
return "0以上で入力してください";
}}},
function renderer_i(value,record,columnObj,grid,colNo,rowNo){
var retval = "<img src='"
+ value
+ "'>";
return retval;
}