jqGrid在IE7中加载subgrid时遇到问题 [英] jqGrid has issues loading subgrid in IE7

查看:82
本文介绍了jqGrid在IE7中加载subgrid时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试获取"网格作为子网格"功能正常,运气不佳.我认为我在代码中做错了,因为在独立测试中可以正常工作.但是,我终于注意到我的应用程序和测试页之间的 only 区别是我的应用程序在IE7上运行,而我的测试页在Firefox中运行.果然,当我在IE7中加载测试页时,我遇到了同样的问题.

I've been trying to get the "Grid as Subgrid" feature working and have not been having much luck. I thought it was something wrong I was doing in my code, as it was working fine in a stand-alone test. However, I finally noticed the only difference between my app and my test page was my app was running on IE7 and I was running my test page in Firefox. Sure enough, when I loaded the test page in IE7 I had the same issue.

将在IE7上重现该问题的代码如下:

The code that will repro the issue on IE7 is as follows:

$(function () {
    function loadTasks(subgrid_id, row_id)
    {
        var id = subgrid_id + '_t';
        $('#' + subgrid_id).html('<table id="' + id + '"></table>');
        jQuery("#" + id).jqGrid({
            datatype: 'local',
            colNames: ['No','Item','Qty','Unit'],
            colModel: [
                {name:'num',index:'num',width:80,key:true},
                {name:'item',index:'item',width:130},
                {name:'qty',index:'qty',width:70,align:'right'},
                {name:'unit',index:'unit',width:70,align:'right'}
            ],
            height: '100%'
        });
    }

    var x = $("#grid").jqGrid({
        jsonReader: { root: "rows", repeatitems: false },
        datatype: "json",
        height: 'auto',
        autowidth: true,
        forceFit: true,
        colNames:['ID','Name'],
        colModel:[
            {name:'id', key:true, index:'id', width:60, sorttype:"int", jsonmap:"id"},
            {name:'name', index:'foobar', width:90,  jsonmap: "name"}
        ],

        subGrid: true,
        subGridRowExpanded: loadTasks,
        caption: "Results"
    });

    var jsonData = [
        {id: 1, name: 'Apple'},
        {id: 2, name: 'Banana'},
        {id: 3, name: 'Pear'},
        {id: 4, name: 'Orange'}
    ];

    x[0].addJSONData( { rows: jsonData } );
});

似乎在每一行上都创建了一些假元素,这些元素在行内无法正确呈现.以下是此内容在IE7上呈现方式的屏幕截图:

It seems to create some bogus elements on each row, which don't render correctly inside the row. Here's a screen capture of how this renders on IE7:

奇怪的是,那些未定义"行实际上是有效网格行的一部分,如果我将鼠标悬停在"Apple"上,那么第一行 undefined 行也会突出显示.

What's odd is those "undefined" rows are actually part of the valid grid rows, if I hover the mouse over "Apple", then the first undefined row also highlights.

我选择jqGrid而不是其他网格的主要原因是它支持嵌套多个网格(这是我们的应用程序真正需要的),但是我们的企业标准仍然是IE7,因此我们需要支持此浏览器.我有什么办法可以使此功能在IE7下正常工作?

The main reason I chose jqGrid over the other grids was its support for nesting multiple grids (which we really need for our app), however our corporate standard is still IE7 so we need to support this browser. Is there anything I can do to make this feature work right under IE7?

推荐答案

我报告了该错误该行,其中使用+=代替=.结果,undefined被添加到了具有子网格的每一行.

I reported the bug here. The problem was the typing error in the line where += was used instead of =. As the result undefined was added to every row having subgrid.

这是不典型的,但是Tony在我的错误报告后修改了jqGrid的代码,并将其发布在

It's untypical, but Tony modified the code of jqGrid after my bug report and published it on the download page under the same version number 4.3.2. So there are two different versions of jqGrid (with the bug and without it) with the same version number.

因此,要解决此问题,只需刷新所使用的jqGrid 4.3.2.

So to solve the problem you should just refresh the jqGrid 4.3.2 which you use.

更新:我下载了新jqGrid 4.3.2"的源代码,我感到非常惊讶,因为它不仅包含当前的错误修复,而且还包含上次在jqGrid中所做的许多其他更改.时间.顺便提一句,我从更改中提出了很多建议.例如,一个人现在可以在搜索对话框"中使用自定义控件(请参见我最近的回答此处),一个人可以使用searchOnEnter和SearchingDialog中的closeOnEscape,在那里有新的afterChange回调.英文和德文的语言环境已已修复.例如,现在在grid.locale-en.js中将逗号用作thousandsSeparator.这很奇怪,但是grid.locale-en.jsgrid.locale-de.js的新版本仅放在src\i18n子目录中.子目录js\i18n包含文件的版本(???).我可以继续...

UPDATED: I downloaded the sources of "new jqGrid 4.3.2" and I am very surprised because it contains not only the current bug fix, but also many other changes which was done in jqGrid last time. Many from the changes was suggested by my by the way. For example one can use now custom controls in the Searching Dialog (see my recent answer here), one can use searchOnEnter and closeOnEscape in the SearchingDialog, new afterChange callback is there. Locales for English and German are fixed. For example now it will be used comma as thousandsSeparator in grid.locale-en.js. It's very strange, but new versions of grid.locale-en.js and grid.locale-de.js are placed only in src\i18n subdirectory. The subdirectory js\i18n contains old version of the files (???). I can continue...

无论如何,我建议大家刷新以前从

In any way I recommend everyone to refresh the sources of jqGrid 4.3.2 previously downloaded from the download page.

这篇关于jqGrid在IE7中加载subgrid时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆