easyui工作使用中的datagrid和ie兼容问题解决记录(二 :多个datagrid在ie下,有的数据会显示,有时不显示)

  $.ajax({
                type: "post",
                dataType: "json", 
                url: "/Service/Customer.ashx?Method=getTopTenCostomer&type=0",
                async: true,//表示同步执行                    
                success: function (data) {    
                    //console.log(data);
            $("#dg_top10yingli").datagrid({

                height: $("#div3").height() - 33,
                onLoadSuccess: function (data) {
                    //console.log($('#dg_top10yingli').height());
                    //$('#dg_top10yingli').datagrid('resize', {
                    //    height: $("#div3").height() - 33
                    //    //width: $("#div3").width()-4,
                    //});
                    //$(window).resize(function () {
                    //    $('#dg_top10yingli').datagrid('resize', {
                    //        height: $("#div3").height() - 33
                    //        //width: $("#div3").width()-4,
                    //    });
                    //});
                    
                },
                singleSelect: true, //选中一行的设置
                rownumbers: true, //行号
                //height: h,
                //width: $("#div3").width() - 4,
                //url: "/Service/Customer.ashx?Method=getTopTenCostomer&type=0", //请求路径
                //title: "学员信息", //标题
                data:data,
                iconCls: "icon-save", //图标
                sortName: '现有收益',
                sortOrder: 'desc',
                collapsible: true, //隐藏按钮
                loadMsg: '数据加载中......',
                //frozenColumns: [[
                //{ field: "chk", "checkbox": true }]],
                frozenColumns: [[
                  {
                      field: "客户姓名", title: "客户姓名", width: 70, align: 'center', formatter: function (value, row, index) {
                          if (row.基金账号 == 'null')
                              top.$.messager.alert('提示', '客户' + row.客户姓名 + '没有开通基金账户!');
                          else
                              return "<a style='color:blue;cursor:pointer' onclick=\"top.go('" + row.客户姓名 + "','/Web/Customer/customer.aspx?fundAccount=" + row.基金帐号 + "')\">" + value + "</a>"
                      }
                  }
                ]],
                columns: [[
                { field: "年龄", title: "年龄", width: 40, align: 'center', halign: 'center' },
                { field: "性别", title: "性别", width: 40, align: 'center', halign: 'center' },
                { field: "持有支数", title: "支数", width: 40, align: 'center', halign: 'center' },
                {
                    field: "现有本金", title: "投资金额", width: 95, align: 'right', halign: 'center', formatter: function (value, row, index) {
                        return parent.NumFixed2(value)
                    }
                },
                {
                    field: "现有市值", title: "现有市值", width: 95, align: 'right', halign: 'center', formatter: function (value, row, index) {
                        return parent.NumFixed2(value)
                    }
                },
                {
                    field: "现有收益", title: "现有收益", width: 95, align: 'right', halign: 'center', formatter: function (value, row, index) {
                        return parent.formatNumFixed2Color(value)
                    }
                },
                {
                    field: "现有收益率", title: "现有收益率", width: 85, align: 'right', halign: 'center', formatter: function (value, row, index) {
                        return parent.formatNumFixed2ColorPercent(value)
                    }
                }
                ]],
                //传输参数
                pagination: false
            });
        //})
                }
            });
如上所述,当datagrid是url获取数据的时候,一个页面有多个datagrid,会出现诡异的问题,某几个datagrid有数据显示,有的datagrid没有任何显示,(ps:因为在之前碰到过类似的问题,当多个ajax都为同步请求 ayscn:false,默认为true,同时请求一个url时,也出现过这个诡异问题,于是换成手动写请求,如上所示,问题解决)

猜你喜欢

转载自blog.csdn.net/xu2034029667/article/details/80395473