Easyui Datagrid Format设置行内按钮

 1 function fLoadTable() {
 2            $('#tt').datagrid({
 3                title: '',
 4                url: location.href,
 5                pagination: true,
 6                pageSize: 20,
 7                pagePosition: 'top',
 8                striped: true,
 9                singleSelect: true,
10                rownumbers: true,
11                columns: [[
12                    {
13                        field: 'ID', title: 'ID', align: 'center', formatter: function (value, row, index) {
14                            return row.Room_id;
15                        }
16                    },
17                    { field: 'FullBdName', title: '建筑', align: 'center' },
18                    { field: 'RoomName', title: '房间', align: 'center' },
19                    { field: 'ModuleAddr', title: '电表', hidden: true, align: 'center' },
20                    { field: 'ModuleCurrValue', title: '当前电表读数', align: 'center' },
21                    { field: 'ModuleRdValue', title: '当前电表剩余量', hidden: true, align: 'center' },
22                    { field: 'MthPayValue', title: '本月购电量', align: 'center' },
23                    { field: 'MthBaseValue', title: '本月赠电量', align: 'center' },
24                    { field: 'MthAcpValue', title: '上月结电量', align: 'center' },
25                    { field: 'MthUseValue', title: '本月用电量', align: 'center' },
26                    { field: 'DayUseValue', title: '本日用电量', align: 'center' },
27                    { field: 'syValue', title: '当前剩余电量', align: 'center' },
28                    { field: 'isSSR_S', title: '继电器状态', align: 'center' },
29                    { field: 'Update_dt', title: '最后通信时间', align: 'center' },
30                 { field: 'Room_id', title: '查看详细', align: 'center', formatter: fInfo }//主要是看这里
31                ]]
32            });
33        };
34        function fInfo(rowIndex, rowData) {
35            return '<a href="javascript:fOpenRoomDetail(\'' + rowIndex + '\',\'' + rowData.Room_id + '\',\'' + rowData.FullBdName + '\',\'' + rowData.RoomName + '\')">详情</a>';
36        }
37        function fOpenRoomDetail(rowIndex, Room_id, FullBdName, RoomName) {
38            parent.fOpenRoomDetail(rowIndex, Room_id, FullBdName, RoomName);
39            //$('#dlg').dialog({
40            //    title: FullBdName + '->' + RoomName + '→详情',
41            //    width: 935,
42            //    height: 650,
43            //    closed: false,
44            //    cache: false,
45            //    collapsible: true,
46            //    maximizable: true,
47            //    resizable: true,
48            //    shadow: true,
49            //    left: 50,
50            //    top: 10,
51            //    //href: '/ShowData.aspx?RoomID=' + rowIndex,
52            //    modal: true,
53            //    content: '<iframe frameborder="0"  src="/ShowData.aspx?RoomID=' + Room_id + '"  style="height: 98%; width: 100%;" ></iframe>'
54            //});
55        }

 

posted @ 2017-07-27 19:29  像艳遇一样忧伤c  阅读(423)  评论(0编辑  收藏  举报