EasyUI DataGrid formatter 格式化增加鏈接
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>'
//});
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.