var videoWin_c;
function VideoWin_c(recInfos,channum){
//定义列
var fieldDatas="{'columModle':[";
fieldDatas +="{'header':'星期/通道','dataIndex':'head','width':80},"
for(var i=1;i<channum+1;i++)
{
if(i<channum)
fieldDatas+="{'header':'通道'+"+i+",'dataIndex':'chan'+"+i+",'width':100},";
else
fieldDatas+="{'header':'通道'+"+i+",'dataIndex':'chan'+"+i+",'width':100}";
}
fieldDatas += "],'fieldsNames':[";
fieldDatas += "{'name':'head'},"
for(var i=1;i<channum+1;i++)
{
if(i<channum)
fieldDatas+="{'name':'chan'+"+i+"},";
else
fieldDatas+="{'name':'chan'+"+i+"}";
}
fieldDatas+="]}";
var json = new Ext.util.JSON.decode(fieldDatas);
var cm = new Ext.grid.ColumnModel(json.columModle);
//加载数据
var day=recInfos.split(";");
var data=new Array();
for(var i=0;i<7;i++)
{
data[i]=new Array();
for(j=0;j<channum;j++)
{
data[i][0]="星期"+(i+1);
data[i][j+1]=day[j].split("@")[i];
}
}
var store = new Ext.data.SimpleStore({
fields: json.fieldsNames
});
store.loadData(data);
if(videoWin_c){
videoWin_c.destroy();
}
videoWin_c = new Ext.Window({
title:"录像状态",
x:150,
y:50,
width: 800,
height:250,
autoSrcoll:true,
//autoWidth:true,
//autoHeight:true,
layout:'form',
items:[
new Ext.grid.GridPanel({
renderTo:Ext.getBody(),
stripeRows: true,
store:store,
// ds: ds,
cm: cm,
width:780,
height:200,
//autoWidth:true,
autoSrcoll:true
//autoHeight:true
})
]
});
videoWin_c.show();
}
在使用forceFit后,表格的右边的空白区域正好比纵向滚动条宽一点,在高度超出屏幕或者表格高度时可以保证只会出现纵向滚动条,而不会出现横向滚动条。
viewConfig:{
forceFit:true
}