jqGrid - 停止运行此脚本或无响应的脚本提示

时间:2013-11-21 18:44:25

标签: javascript jquery jqgrid

使用jQuery 1.9.1和jqGrid 4.5.2显示表中的数据。我不能使用ASP.NET或PHP。我正在使用日期&时间控制将数据选择限制为最多90天。我也使用下拉菜单来过滤数据,但使用它们是可选的。

写入表格的平均行数约为每天2000(在5天工作周内)。

在使用下面定义的网格进行测试时,我将大约2500行拉入网格。 IE8提示我大约六次使用“停止运行此脚本”的消息,Firefox也给了我“Unresponsive script”提示。排序性能类似。

我没有对网格中的数据进行任何编辑,只显示它。我一次显示所有行的主要原因是为了允许用户复制网格和内容的内容。将其粘贴到Excel工作簿中。

网格代码如下:

$("#histGrid").jqGrid({
    url: vhistURL,
    datatype: "xml",
        mtype: "GET",
    colNames: ["ID","SystemID", "Display", "Short Msg","Date/Time", "Historical Msg"],
        colModel:[
        {name:"HistID",
        index:"HistID",
        hidden: true,
        width:10,
        align:"left",
        sorttype:"int",
        xmlmap:"Rowset>Row>HistID"
        },
        {name:"MachineID",
        index:"MachineID",
        width:23,
        align:"center", 
        sorttype:"int",
        xmlmap:"Rowset>Row>MachineID"
        },
        {name:"DisplayName",
        index:"DisplayName",
        width:52,
        align:"left",
        sorttype:"text",
        xmlmap:"Rowset>Row>DisplayName"
        },
        {name:"MsgText",
        index:"MsgText",
        width: 150,
        align:"left",
        sorttype:"text",
        xmlmap:"Rowset>Row>MsgText"
        },
        {name:"HistDateTime",
        index:"HistDateTime",
        width:60,
        align:"center",
        formatter:"date",
        formatoptions: {"srcformat":"ISO8601Long", "newformat":"m/d/Y H:i"},
        sorttype:"date",
        xmlmap:"Rowset>Row>HistDateTime"
        },
        {name:"HistMessage",
        index:"HistMessage",
        width:200,
        align:"left",
        sorttype:"text",
        xmlmap:"Rowset>Row>HistMessage"
        }
        ],
    rowNum: 100000,                 
    pager: jQuery("#pager1"),
    sortname:"HistID",
    sortorder: "asc",
    viewrecords: true,
    gridview: true,
    width: gridwidth,
    autoencode: true,
    loadonce: true,
    height: "100%",
    toolbar: [true, "top"],
    hidegrid: false,                // hides the ability to collapse grid
    defaults: {
        altrows: true, 
        recordtext: "View {0} - {1} of {2}",
        emptyrecords:  "No records to view",
        pgtext: "Page  {0} of {1}"
        },
    xmlReader:  { 
        root: "Rowsets", 
                row: "Row",
        repeatitems: false,
        id: "HistID"
        },
    loadComplete: function() { 
        // bold the column headers
        $("th.ui-th-column").css("font-size","1.25em");
        $("th.ui-th-column").css("font-weight","bold");
        $("td",".jqgrow").css("font-size","1.15em");
        }
    });

我已经选择停止运行一次脚本,IE8将我带入代码的loadComplete部分(最后一行)。

就像我说的那样,它不仅仅是抓住数据而已。排序,但表现很糟糕。

如何才能在jqGrid中显示相对较多的行?我需要解决的代码中的任何性能项目?

0 个答案:

没有答案