EasyUI DataGrid formatter 格式化增加链接
2015-10-15 09:38
369 查看
function fLoadTable() {
$('#tt').datagrid({
title: '',
url: location.href,
pagination: true,
pageSize: 20,
pagePosition: 'top',
striped: true,
singleSelect: true,
rownumbers: true,
columns: [[
{
field: 'ID', title: 'ID', align: 'center', formatter: function (value, row, index) {
return row.Room_id;
}
},
{ field: 'FullBdName', title: '建筑', align: 'center' },
{ field: 'RoomName', title: '房间', align: 'center' },
{ field: 'ModuleAddr', title: '电表', hidden: true, align: 'center' },
{ field: 'ModuleCurrValue', title: '当前电表读数', align: 'center' },
{ field: 'ModuleRdValue', title: '当前电表剩余量', hidden: true, align: 'center' },
{ field: 'MthPayValue', title: '本月购电量', align: 'center' },
{ field: 'MthBaseValue', title: '本月赠电量', align: 'center' },
{ field: 'MthAcpValue', title: '上月结电量', align: 'center' },
{ field: 'MthUseValue', title: '本月用电量', align: 'center' },
{ field: 'DayUseValue', title: '本日用电量', align: 'center' },
{ field: 'syValue', title: '当前剩余电量', align: 'center' },
{ field: 'isSSR_S', title: '继电器状态', align: 'center' },
{ field: 'Update_dt', title: '最后通信时间', align: 'center' },
{ field: 'Room_id', title: '查看详细', align: 'center', formatter: fInfo }//主要是看这里
]]
});
};
function fInfo(rowIndex, rowData) {
return '<a href="javascript:fOpenRoomDetail(\'' + rowIndex + '\',\'' + rowData.Room_id + '\',\'' + rowData.FullBdName + '\',\'' + rowData.RoomName + '\')">详情</a>';
}
function fOpenRoomDetail(rowIndex, Room_id, FullBdName, RoomName) {
parent.fOpenRoomDetail(rowIndex, Room_id, FullBdName, RoomName);
//$('#dlg').dialog({
// title: FullBdName + '->' + RoomName + '→详情',
// width: 935,
// height: 650,
// closed: false,
// cache: false,
// collapsible: true,
// maximizable: true,
// resizable: true,
// shadow: true,
// left: 50,
// top: 10,
// //href: '/ShowData.aspx?RoomID=' + rowIndex,
// modal: true,
// content: '<iframe frameborder="0" src="/ShowData.aspx?RoomID=' + Room_id + '" style="height: 98%; width: 100%;" ></iframe>'
//});
}
$('#tt').datagrid({
title: '',
url: location.href,
pagination: true,
pageSize: 20,
pagePosition: 'top',
striped: true,
singleSelect: true,
rownumbers: true,
columns: [[
{
field: 'ID', title: 'ID', align: 'center', formatter: function (value, row, index) {
return row.Room_id;
}
},
{ field: 'FullBdName', title: '建筑', align: 'center' },
{ field: 'RoomName', title: '房间', align: 'center' },
{ field: 'ModuleAddr', title: '电表', hidden: true, align: 'center' },
{ field: 'ModuleCurrValue', title: '当前电表读数', align: 'center' },
{ field: 'ModuleRdValue', title: '当前电表剩余量', hidden: true, align: 'center' },
{ field: 'MthPayValue', title: '本月购电量', align: 'center' },
{ field: 'MthBaseValue', title: '本月赠电量', align: 'center' },
{ field: 'MthAcpValue', title: '上月结电量', align: 'center' },
{ field: 'MthUseValue', title: '本月用电量', align: 'center' },
{ field: 'DayUseValue', title: '本日用电量', align: 'center' },
{ field: 'syValue', title: '当前剩余电量', align: 'center' },
{ field: 'isSSR_S', title: '继电器状态', align: 'center' },
{ field: 'Update_dt', title: '最后通信时间', align: 'center' },
{ field: 'Room_id', title: '查看详细', align: 'center', formatter: fInfo }//主要是看这里
]]
});
};
function fInfo(rowIndex, rowData) {
return '<a href="javascript:fOpenRoomDetail(\'' + rowIndex + '\',\'' + rowData.Room_id + '\',\'' + rowData.FullBdName + '\',\'' + rowData.RoomName + '\')">详情</a>';
}
function fOpenRoomDetail(rowIndex, Room_id, FullBdName, RoomName) {
parent.fOpenRoomDetail(rowIndex, Room_id, FullBdName, RoomName);
//$('#dlg').dialog({
// title: FullBdName + '->' + RoomName + '→详情',
// width: 935,
// height: 650,
// closed: false,
// cache: false,
// collapsible: true,
// maximizable: true,
// resizable: true,
// shadow: true,
// left: 50,
// top: 10,
// //href: '/ShowData.aspx?RoomID=' + rowIndex,
// modal: true,
// content: '<iframe frameborder="0" src="/ShowData.aspx?RoomID=' + Room_id + '" style="height: 98%; width: 100%;" ></iframe>'
//});
}
相关文章推荐
- easyui------显示隐藏列功能
- jQuery寻找n以内完全数的方法
- 推荐10个2014年最佳的jQuery视频插件
- jquery+CSS3实现淘宝移动网页菜单效果
- 采用easyui tree编写简单角色权限代码的方法
- 基于jquery中children()与find()的区别介绍
- 了解jQuery技巧来提高你的代码(个人觉得那个jquery的手册很不错)
- 在easyUI开发中,出现jquery.easyui.min.js函数库问题的解决办法
- JQuery打造PHP的AJAX表单提交实例
- jquery easyui使用心得
- 初试jQuery EasyUI 使用介绍
- easyui Droppable组件实现放置特效
- jQuery实现的fixedMenu下拉菜单效果代码
- jQuery EasyUI Dialog拖不下来如何解决
- jQuery EasyUI实现右键菜单变灰不可用效果
- 浅谈jQuery构造函数分析
- 在VS2008中使用jQuery智能感应的方法
- 从Ajax到JQuery Ajax学习
- jQuery仿gmail实现fixed布局的方法
- jQuery判断当前点击的是第几个li的代码