//复选框的声明
var sm = new Ext.grid.CheckboxSelectionModel();
//创建一个列表
var grid = new Ext.grid.GridPanel(
{
width: ${comm.gridWidth},
height:${comm.gridHeight},
title:"${pageTitle}",
store: store,
trackMouseOver:true,
disableSelection:false,
loadMask: true,
columnLines: true,
id:'roadId',
cm:new Ext.grid.ColumnModel([sm,
{
header: "名称",
dataIndex: 'roadName',
width: 120,
sortable: true
},{
header: "组成点数",
dataIndex: 'rptotal',
width: 100,
sortable: true,
renderer:function(val){
return "<a href='#' style='text-decoration:none'>"+val+"</a>";
}
},{
header: "基站数",
dataIndex: 'rstotal',
width: 100,
sortable: true,
renderer:function(val){
return "<a href='#' style='text-decoration:none' >"+val+"</a>";
}
},{
header: "告警数",
dataIndex: 'alarmtotal',
width: 100,
sortable: true,
renderer:function(val){
return "<a href='#' style='text-decoration:none'>"+val+"</a>";
}
},{
header: "状态",
dataIndex: 'roadState',
width: 100,
sortable: true,
renderer: function(val) {if(val== 2) return "告警"; else if(val==1) return "正常"; else return "初始";}
]),
sm:sm,
bbar: new Ext.PagingToolbar({
pageSize: 20,
store: store,
displayInfo: true,
displayMsg: '参数 {0} - {1} of {2}',
emptyMsg: "无相关记录"
}),
tbar: _toolbar.getObject()
});
//这段里面的renderer 是为了让列表显示成超连接的样式
{
header: "组成点数",
dataIndex: 'rptotal',
width: 100,
sortable: true,
renderer:function(val){
return "<a href='#' style='text-decoration:none'>"+val+"</a>";
}
}
// 为列表添加单元格侦听事件
grid.on("cellclick",function(gp,rowIndex,columnIndex)
{
//如果没有选中。直接返回
if(!sm.getSelections()) return;
//获取 roadId
var roadId = sm.getSelections()[0].get('roadId');
if(columnIndex == 7){
window.location.href= util.addUrlParam('${comm.toAction("/area/roadpoints")}',"roadId",roadId);;
}
});