• jqGrid


    
    <script>
        $(function () {
            gridList();
        })
        function gridList() {
            var $gridList = $("#gridList");
            $gridList.dataGrid({
                url: "/SystemManage/User/GetGridJson",
                height: $(window).height() - 128,
                colModel: [
                    { label: '主键', name: 'F_Id', hidden: true },
                    { label: '账户', name: 'F_Account',  80, align: 'left' },
                    { label: '姓名', name: 'F_RealName',  80, align: 'left' },
                    {
                        label: '性别', name: 'F_Gender',  60, align: 'center',
                        formatter: function (cellvalue, options, rowObject) {
                            if (cellvalue == true) {
                                return '男';
                            } else {
                                return '女';
                            }
                        }
                    },
                    { label: '手机', name: 'F_MobilePhone',  80, align: 'left' },
                    {
                        label: '公司', name: 'F_OrganizeId',  150, align: 'left',
                        formatter: function (cellvalue, options, rowObject) {
                            return top.clients.organize[cellvalue] == null ? "" : top.clients.organize[cellvalue].fullname;
                        }
                    },
                    {
                        label: '部门', name: 'F_DepartmentId',  80, align: 'left',
                        formatter: function (cellvalue, options, rowObject) {
                            return top.clients.organize[cellvalue] == null ? "" : top.clients.organize[cellvalue].fullname;
                        }
                    },
                    {
                        label: '岗位', name: 'F_DutyId',  80, align: 'left',
                        formatter: function (cellvalue, options, rowObject) {
                            return top.clients.duty[cellvalue] == null ? "" : top.clients.duty[cellvalue].fullname;
                        }
                    },
                    {
                        label: '创建时间', name: 'F_CreatorTime',  80, align: 'left',
                        formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' }
                    },
                    {
                        label: "允许登录", name: "F_EnabledMark",  60, align: "center",
                        formatter: function (cellvalue, options, rowObject) {
                            if (cellvalue == 1) {
                                return '<span class="label label-success">正常</span>';
                            } else if (cellvalue == 0) {
                                return '<span class="label label-default">禁用</span>';
                            }
                        }
                    },
                    { label: '备注', name: 'F_Description',  200, align: 'left' }
                ],
                pager: "#gridPager",
                sortname: 'F_DepartmentId asc,F_CreatorTime desc',
                viewrecords: true
            });
            $("#btn_search").click(function () {
                $gridList.jqGrid('setGridParam', {
                    postData: { keyword: $("#txt_keyword").val() },
                }).trigger('reloadGrid');
            });
        }
        function btn_add() {
            $.modalOpen({
                id: "Form",
                title: "新增用户",
                url: "/SystemManage/User/Form",
                 "700px",
                height: "510px",
                callBack: function (iframeId) {
                    top.frames[iframeId].submitForm();
                }
            });
        }
        function btn_edit() {
            var keyValue = $("#gridList").jqGridRowValue().F_Id;
            $.modalOpen({
                id: "Form",
                title: "修改用户",
                url: "/SystemManage/User/Form?keyValue=" + keyValue,
                 "700px",
                height: "510px",
                callBack: function (iframeId) {
                    top.frames[iframeId].submitForm();
                }
            });
        }
        function btn_delete() {
            $.deleteForm({
                url: "/SystemManage/User/DeleteForm",
                param: { keyValue: $("#gridList").jqGridRowValue().F_Id },
                success: function () {
                    $.currentWindow().$("#gridList").trigger("reloadGrid");
                }
            })
        }
        function btn_details() {
            var keyValue = $("#gridList").jqGridRowValue().F_Id;
            $.modalOpen({
                id: "Details",
                title: "查看用户",
                url: "/SystemManage/User/Details?keyValue=" + keyValue,
                 "700px",
                height: "550px",
                btn: null,
            });
        }
        function btn_revisepassword() {
            var keyValue = $("#gridList").jqGridRowValue().F_Id;
            var Account = $("#gridList").jqGridRowValue().F_Account;
            var RealName = $("#gridList").jqGridRowValue().F_RealName;
            $.modalOpen({
                id: "RevisePassword",
                title: '重置密码',
                url: '/SystemManage/User/RevisePassword?keyValue=' + keyValue + "&account=" + escape(Account) + '&realName=' + escape(RealName),
                 "450px",
                height: "260px",
                callBack: function (iframeId) {
                    top.frames[iframeId].submitForm();
                }
            });
        }
        function btn_disabled() {
            var keyValue = $("#gridList").jqGridRowValue().F_Id;
            $.modalConfirm("注:您确定要【禁用】该项账户吗?", function (r) {
                if (r) {
                    $.submitForm({
                        url: "/SystemManage/User/DisabledAccount",
                        param: { keyValue: keyValue },
                        success: function () {
                            $.currentWindow().$("#gridList").trigger("reloadGrid");
                        }
                    })
                }
            });
        }
        function btn_enabled() {
            var keyValue = $("#gridList").jqGridRowValue().F_Id;
            $.modalConfirm("注:您确定要【启用】该项账户吗?", function (r) {
                if (r) {
                    $.submitForm({
                        url: "/SystemManage/User/EnabledAccount",
                        param: { keyValue: keyValue },
                        success: function () {
                            $.currentWindow().$("#gridList").trigger("reloadGrid");
                        }
                    })
                }
            });
        }
    </script>
    
    jQuery("#myTab").jqGrid({ 
    datatype: "json", //将这里改为使用JSON数据 
    url:'DataServlet', //这是Action的请求地址 
    mtype: 'POST', 
    height: 250, 
     400, 
    colNames:['编号','姓名', '电话'], 
    colModel:[ 
    {name:'id',index:'id', 60, sorttype:"int"}, 
    {name:'name',index:'name', 90}, 
    {name:'phone',index:'phone', 100} 
    ], 
    pager: 'pager', //分页工具栏 
    imgpath: 'js/themes/basic/images', //图片存放路径 
    rowNum:10, //每页显示记录数 
    viewrecords: true, //是否显示行数 
    rowList:[10,20,30], //可调整每页显示的记录数 
    multiselect: false, //是否支持多选 
    caption: "信息显示" 
    }); 
    
    
    
    
    
  • 相关阅读:
    kernel makefile分析 之include路径分析
    python模块,包,安装
    python 资源
    Python版QQ群发消息
    marvell 88f6282 工程包制作
    CPU : 二级缓存容量
    编译多个文件到内核模块
    展布频谱(Spread Spectrum, SS)
    编程练习 链表题目反序,合并
    汇编语言基础之七 框架指针的省略(FPO)
  • 原文地址:https://www.cnblogs.com/chenmfly/p/6019625.html
Copyright © 2020-2023  润新知