码迷,mamicode.com
首页 > 其他好文 > 详细

EasyUI DataGrid formatter 格式化增加链接

时间:2015-10-15 10:01:01      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:

        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>‘
            //});
        }



EasyUI DataGrid formatter 格式化增加链接

标签:

原文地址:http://www.cnblogs.com/nangong/p/4881416.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!