zoukankan      html  css  js  c++  java
  • JqGrid常用示例

    初始化加载数据

    $("#jqGrid").jqGrid({
                    url: 'CCProjectileInfo.aspx?Action=GetInBillList',
                    //url: 'http://trirand.com/blog/phpjqgrid/examples/jsonp/getjsonp.php?callback=?&qwery=longorders',
                    mtype: "GET",
                    styleUI: 'Bootstrap',
                    datatype: "json",
                    postData: { UserID: userId },
                    colModel: [
                        //{ label: '交流类型', name: 'ID', key: true,  200 },
                        { label: '交流类型', name: '',  200, formatter: function (value, grid, rows, state) { return "Inbound交流记录" } },
                        { label: '处理时间', name: 'CreateDate',  170, formatter: function (value) { return value.replace("T", " ") } },
                        { label: '处理账号', name: 'CreateBy',  100 },
                        { label: '反馈内容', name: 'FromContent',  300 },
                        { label: '回馈内容', name: 'ToContent',  300 },
                        { label: '操作', name: '',  100, formatter: function (value, grid, rows, state) { return "<a href="javascript:void(0)" style="color:#f60" onclick="ShowBoundInfo(" + rows.ID + ",1)">查看</a>" } }
                    ],
                    viewrecords: true,
                    height: 250,
                    rowNum: 20,
                    rowList: [10, 20, 50, 100], //每页记录数可选列表  
                    pager: "#jqGridPager"
                });
    View Code

    添加数据,后刷新jqGrid列表

    $("#btnSaveOutBill").bind("click", function () {
                    if ($("#dfjg").val() == "" || $("#khdy2").val() == "" || $("#wyzt").val() == "") {
                        layer.msg("所有标红的为必填项!", { icon: 2 });
                        return;
                    }
                    if (userId < 1) {
                        layer.msg("请先保存用户基本信息!", { icon: 2 });
                        return;
                    }
                    $.ajax({
                        url: 'CCProjectileInfo.aspx?Action=AddOutBill&UserID=' + userId,
                        data: { handleAccount:$(".handAccount").eq(2).val(), hfzt: $("#hfzt").val(), dfjg: $("#dfjg").val(), dfsm: $("#dfsm").val(), khdy: $("#khdy2").val(), wyzt: $("#wyzt").val(), cpsl: $("#cpsl2").val(), sfth: $("#rdb_sfths2").is(":checked"), yjlp: $("#rdb_yjlps2").is(":checked"), jtdf: $("#rdb_jtdfs2").is(":checked"), jsdx: $("#rdb_jsdxs2").is(":checked"), ygyl: $("#ygyl").val(), zpyy: $("#zpyy2").val(), zppp: $("#zppp2").val(), zpsj: $("#zpsj2").val(), fknr: $("#fknr2").val(), hknr: $("#hknr2").val() },
                        success: function (r) {
                            if (r == true) {
                                layer.msg("添加成功!", { icon: 1 });
                                var outdata = { UserID: userId };
                                $("#jqGrid2").jqGrid('setGridParam', {
                                    datatype: 'json',
                                    postData: outdata, //发送数据 
                                    page: 1
                                }).trigger("reloadGrid"); //重新载入 
                                //$("#jqGrid2").trigger("reloadGrid");  //刷新数据列表
                            }
                            else
                                layer.msg("添加失败!", { icon: 2 });
                        }
                    })
                })
    View Code

    按条件搜索后,刷新列表

    $("#btn_jfSearch").bind("click", function () {
                    var jfData = { jflx: $("#jf_jflx").val(), jfkssj: $("#jf_startTime").val(), jfjssj: $("#jf_endTime").val(), jfcp: $("#jf_procuct").val(), mdbh: $("#jf_clientCode").val(), mdmc: $("#jf_clientName").val(), jf_dg: $("#jf_dg").val(), jf_kf: $("#jf_kf").val() };
                    //alert(JSON.stringify(jfData))
                    // $('#jqGrid_jf').jqGrid('clearGridData');  //清空表格  数据 
                    $("#jqGrid_jf").jqGrid('setGridParam', {
                        datatype: 'json',
                        postData: jfData, //发送数据 
                        page: 1
                    }).trigger("reloadGrid"); //重新载入 
                })
    View Code

    后台分页获取列表数据

     public string GetBillList(int type)
            {
                int UserID = Convert.ToInt32(Request.Params["UserID"]);
                int pageIndex = Convert.ToInt32(Request.Params["page"]);
                int pageSize = Convert.ToInt32(Request.Params["rows"]);
                int totalRecord = recordBll.GetRecordCount(" UserID=" + UserID + " and Type=" + type);
                int totalPage = (totalRecord / pageSize) + ((totalRecord % pageSize) > 0 ? 1 : 0);
                DataSet ds = recordBll.GetListByPage(" Type=" + type + " and UserID=" + UserID, "", (pageIndex - 1) * pageSize, pageIndex * pageSize);
                List<Maticsoft.Model.CRM.CRM_ACRecord> list = recordBll.DataTableToList(ds.Tables[0]);
                return JsonConvert.SerializeObject(new PageDataModel() { records = totalRecord, page = pageIndex, total = totalPage, rows = list });
            }
    View Code
  • 相关阅读:
    minio 对于压缩的处理
    mino federation 功能
    Full Schema Stitching with Apollo Server
    GraphQL Gateway Architectures
    Modularizing your graphQL schemas
    gearman openresty 集成试用
    madlib 集成 hasura graphql-engine 试用
    Oracle数据库--解决单张表中数据量巨大(大数据、数据量上百万级别,后查询,更新数据等耗时剧增)
    绝对干货,教你4分钟插入1000万条数据到mysql数据库表,快快进来
    几款开源的ETL工具及ELT初探
  • 原文地址:https://www.cnblogs.com/SmilePastaLi/p/8327868.html
Copyright © 2011-2022 走看看